The web application for analyzing web pages written with golang.
______ _______ _________ _______ _______ __________________ _______
( __ \ ( ____ \\__ __/( ____ \( ____ \\__ __/\__ __/|\ /|( ____ \
| ( \ )| ( \/ ) ( | ( \/| ( \/ ) ( ) ( | ) ( || ( \/
| | ) || (__ | | | (__ | | | | | | | | | || (__
| | | || __) | | | __) | | | | | | ( ( ) )| __)
| | ) || ( | | | ( | | | | | | \ \_/ / | (
| (__/ )| (____/\ | | | (____/\| (____/\ | | ___) (___ \ / | (____/\
(______/ (_______/ )_( (_______/(_______/ )_( \_______/ \_/ (_______/
Detective is a web application by which you can get useful information about an url. First it will perform an GET request to entry url and then retrieves the following information:
- Version of HTML
- Page Title
- Count of Heading tags (h1-h6)
- Count of links (internal and external)
- Count of inaccessible links
- Existence of Login Form
NOTE
It's a sample golang application, so I tried to make its folders and package structured. You can find the full declaration of standard Golang folder structure at this link. It's not recommended using this folder structure for small projects.
Use docker run --rm -p 8000:8000 mammadmodi/detective:main command to create a container in the foreground.
Just be aware that the mammadmodi/detective:main docker image has been built only for linux/amd64 Arch so if you
use another architecture then try to use one of the following ways.
Clone the project in your local and run the app easily by make up command in your desktop to set up detective
application. It first builds a docker image in your local and then runs an instance of that in the background using
docker compose.
When you finished your work with this app you can stop the application by using make down command.
Install Go in your local and use the bellow command to set up application server:
go run ./cmd/server/main.go
Anyway, when you set up the application, it will be started on port 8000 by default, and you can use its Form to analyze your web pages.
You can configure the application by setting environment variables on your os. The list of available configurations has shown below:
| Variable Name | Type | Default | Description |
|---|---|---|---|
DETECTIVE_ADDR |
string | ":8000" | The address of http server with its port |
DETECTIVE_HTTP_TIMEOUT |
string | "30s" | Timeout for performing http requests |
DETECTIVE_LOGGER_ENABLED |
boolean | true | Feature flag for logger |
DETECTIVE_LOGGER_LEVEL |
string | "info" | Level of logger in string format(debug,info,warn,...) |
DETECTIVE_LOGGER_PRETTY |
boolean | true | If set to false logs will be structured in json objects |
DETECTIVE_LOGGER_FILE_REDIRECT_ENABLED |
false | false | Feature flag for storing logs to files |
DETECTIVE_LOGGER_FILE_REDIRECT_PATH |
string | "/var/log" | Directory of log file storage |
DETECTIVE_LOGGER_FILE_REDIRECT_PREFIX |
string | "detective" | Prefix for log files |