Please note that this project does not include any kind of rate limiting or other protection. It is therefore heavily advised to only make it publicly reachable if a reverse proxy is in place. A sample config for <ahref="caddyserver.com/">Caddy</a> can be found in the `caddy` subfolder.
# Installation
The runtime dependencies are currently `iputils`, `traceroute` and `mtr` (sometimes called `mtr-tiny`). `iputils` and `traceroute` can be substituted by `busybox`.
## Building
The app can be built with the latest Go toolchain.
First get the external module dependencies:
```sh
go get -u
```
Then build the app, this already strips debug symbols.
```sh
go build -ldflags "-s -w" -o "probehost2" main.go
```
(if this is unwanted, just leave out the ldflags argument)
## Systemd
Example files for a systemd service can be found in the `systemd` subfolder.
## Docker
A docker container based on <ahref="https://alpinelinux.org">Alpine</a> can be built by using the included dockerfile (`docker/Dockerfile`).
A compose file can also be found in `docker/docker-compose.yml`.
## Proxy
Its recommended to only run this app together with a rate-limiting reverse-proxy. An example configuration for <ahref="caddyserver.com/">Caddy</a> can be found in the `caddy` subfolder.
# Usage
## Server
The app currently has 4 runtime flags:
-`-p / --listenport` -- sets the port to listen on
-`-o / --logfilepath` -- sets the log output file
-`-x / --disable-x-forwarded-for` -- disables checking for the X-Forwarded-For header
-`-l / --allow-private` -- allows lookups of private IP ranges
The app will log every request including the IP thats querying and show failed requests on stdout.
## Client
### General
The app can be queried via HTTP/HTTPS with the following scheme:
```
https://[address]/[command]/[hosts]/[options]
```
- [address] = the IP or domain serving the site
- [command] = the command to return, currently available:
- ping
- mtr
- traceroute
- [hosts] = can be one or more hosts query, seperated by a comma
- [options] = options to run the command with, seperated by a comma
All inputs are validated and invalid input is discarded. If the request contains no valid data, the server will return HTTP 500.
Local IP ranges are by default excluded from lookups, this currently only includes IPs and not hostnames and can be disabled on the server by passing the -l flag.