mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-21 14:23:15 +00:00
add altnames for options
This commit is contained in:
parent
cd12cab2d0
commit
d3df87b266
80
README.md
80
README.md
@ -1,10 +1,20 @@
|
||||
# probehost2
|
||||
an http endpoint to query network diagnosis tools from remote hosts
|
||||
|
||||
1. Overview
|
||||
2. Disclaimer
|
||||
3. Installation
|
||||
4. Usage
|
||||
- <a href="#probehost2">Overview</a>
|
||||
- <a href="#disclaimer">Disclaimer</a>
|
||||
- <a href="#installation">Installation</a>
|
||||
- <a href="#building">Building</a>
|
||||
- <a href="#systemd">Systemd</a>
|
||||
- <a href="#docker">Docker</a>
|
||||
- <a href="#proxy">Proxy</a>
|
||||
- <a href="#usage">Usage</a>
|
||||
- <a href="#server">Server</a>
|
||||
- <a href="#client">Client</a>
|
||||
- <a href="#general">General</a>
|
||||
- <a href="#ping">Ping</a>
|
||||
- <a href="#mtr">MTR</a>
|
||||
- <a href="#traceroute">Traceroute</a>
|
||||
|
||||
# Disclaimer
|
||||
Dont expect good or even mediocre code here. This is my first take at go and is mostly for myself to learn. Suggestions and improvements are welcome.
|
||||
@ -69,21 +79,21 @@ All inputs are validated and invalid input is discarded. If the request contains
|
||||
|
||||
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.
|
||||
|
||||
Command options are based on the originally given cli flags but also have a more understandable altname (wip).
|
||||
Command options are based on the originally given cli flags but also have a more understandable altname.
|
||||
|
||||
### Ping
|
||||
The default options are:
|
||||
- `-c 10`: send 10 pings
|
||||
|
||||
Available options are:
|
||||
- `4`: force IPv4
|
||||
- `6`: force IPv6
|
||||
- `d`: print timestamps
|
||||
- `n`: no dns name resolution
|
||||
- `v`: verbose output
|
||||
- `c1`: send 1 ping
|
||||
- `c5`: send 5 pings
|
||||
- `c10`: send 10 pings
|
||||
- `4` / `force4`: force IPv4
|
||||
- `6` / `force6`: force IPv6
|
||||
- `d` / `timestamps`: print timestamps
|
||||
- `n` / `nodns`: no dns name resolution
|
||||
- `v` / `verbose`: verbose output
|
||||
- `c1` / `count1`: send 1 ping
|
||||
- `c5` / `count5`: send 5 pings
|
||||
- `c10` / `count10`: send 10 pings
|
||||
|
||||
Example query:
|
||||
```sh
|
||||
@ -103,18 +113,18 @@ The default options are:
|
||||
- `-c10`: send 10 pings
|
||||
|
||||
Available options are:
|
||||
- `4`: force IPv4
|
||||
- `6`: force IPv6
|
||||
- `u`: use UDP instead of ICMP echo
|
||||
- `t`: use TCP instead of ICMP echo
|
||||
- `e`: display information from ICMP extensions
|
||||
- `x`: output xml
|
||||
- `n`: do not resolve host names
|
||||
- `b`: show IP numbers and host names
|
||||
- `z`: display AS number
|
||||
- `c1`: send 1 ping
|
||||
- `c5`: send 5 pings
|
||||
- `c10`: send 10 pings
|
||||
- `4` / `force4`: force IPv4
|
||||
- `6` / `force6`: force IPv6
|
||||
- `u` / `udp`: use UDP instead of ICMP echo
|
||||
- `t` / `tcp`: use TCP instead of ICMP echo
|
||||
- `e` / `ext`: display information from ICMP extensions
|
||||
- `x` / `xml`: output xml
|
||||
- `n` / `nodns`: do not resolve host names
|
||||
- `b` / `cmb`: show IP numbers and host names
|
||||
- `z` / `asn`: display AS number
|
||||
- `c1` / `count1`: send 1 ping
|
||||
- `c5` / `count5`: send 5 pings
|
||||
- `c10` / `count10`: send 10 pings
|
||||
|
||||
Example query:
|
||||
```
|
||||
@ -129,16 +139,16 @@ The default options are:
|
||||
- none
|
||||
|
||||
Available options are:
|
||||
- `4`: force IPv4
|
||||
- `6`: force IPv6
|
||||
- `f`: do not fragment packets
|
||||
- `i`: use ICMP ECHO for tracerouting
|
||||
- `t`: use TCP SYN for tracerouting (default port is 80)
|
||||
- `n`: do not resolve IP addresses to their domain names
|
||||
- `u`: use UDP to particular port for tracerouting (default port is 53)
|
||||
- `ul`: Use UDPLITE for tracerouting (default port is 53)
|
||||
- `d`: Use DCCP Request for tracerouting (default port is 33434)
|
||||
- `b`: Guess the number of hops in the backward path and print if it differs
|
||||
- `4` / `force4`: force IPv4
|
||||
- `6` / `force6`: force IPv6
|
||||
- `f` / `dnf`: do not fragment packets
|
||||
- `i` / `ìcmp`: use ICMP ECHO for tracerouting
|
||||
- `t` / `tcp`: use TCP SYN for tracerouting (default port is 80)
|
||||
- `n` / `nodns`: do not resolve IP addresses to their domain names
|
||||
- `u` / `udp`: use UDP to particular port for tracerouting (default port is 53)
|
||||
- `ul` / `udplite`: Use UDPLITE for tracerouting (default port is 53)
|
||||
- `d` / `dccp`: Use DCCP Request for tracerouting (default port is 33434)
|
||||
- `b` / `back`: Guess the number of hops in the backward path and print if it differs
|
||||
|
||||
Example query:
|
||||
```
|
||||
|
15
main.go
15
main.go
@ -119,7 +119,10 @@ func prerunner(req *http.Request, cmd string, cmdopts map[string]string, default
|
||||
|
||||
func ping(w http.ResponseWriter, req *http.Request) {
|
||||
cmd := "ping"
|
||||
cmdopts := map[string]string{"4": "-4", "6": "-6", "d": "-D", "n": "-n", "v": "-v", "c1": "-c1", "c5": "-c5", "c10": "-c10"}
|
||||
cmdopts := map[string]string{
|
||||
"4": "-4", "6": "-6", "d": "-D", "n": "-n", "v": "-v", "c1": "-c1", "c5": "-c5", "c10": "-c10",
|
||||
"force4": "-4", "force6": "-6", "timestamps": "-D", "nodns": "-n", "verbose": "-v", "count1": "-c1", "count5": "-c5", "count10": "-c10",
|
||||
}
|
||||
var defaultopts []string
|
||||
defaultopts = append(defaultopts, "-c10")
|
||||
res := prerunner(req, cmd, cmdopts, defaultopts)
|
||||
@ -132,7 +135,10 @@ func ping(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
func mtr(w http.ResponseWriter, req *http.Request) {
|
||||
cmd := "mtr"
|
||||
cmdopts := map[string]string{"4": "-4", "6": "-6", "u": "-u", "t": "-T", "e": "-e", "x": "-x", "n": "-n", "b": "-b", "z": "-z", "c1": "-c1", "c5": "-c5", "c10": "-c10"}
|
||||
cmdopts := map[string]string{
|
||||
"4": "-4", "6": "-6", "u": "-u", "t": "-T", "e": "-e", "x": "-x", "n": "-n", "b": "-b", "z": "-z", "c1": "-c1", "c5": "-c5", "c10": "-c10",
|
||||
"force4": "-4", "force6": "-6", "udp": "-u", "tcp": "-T", "ext": "-e", "xml": "-x", "nodns": "-n", "cmb": "-b", "asn": "-z", "count1": "-c1", "count5": "-c5", "count10": "-c10",
|
||||
}
|
||||
var defaultopts []string
|
||||
defaultopts = append(defaultopts, "-r", "-w", "-c10")
|
||||
res := prerunner(req, cmd, cmdopts, defaultopts)
|
||||
@ -145,7 +151,10 @@ func mtr(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
func traceroute(w http.ResponseWriter, req *http.Request) {
|
||||
cmd := "traceroute"
|
||||
cmdopts := map[string]string{"4": "-4", "6": "-6", "dnf": "-F", "i": "-I", "t": "-T", "n": "-n", "u": "-U", "ul": "-UL", "d": "-D", "b": "--back"}
|
||||
cmdopts := map[string]string{
|
||||
"4": "-4", "6": "-6", "f": "-F", "i": "-I", "t": "-T", "n": "-n", "u": "-U", "ul": "-UL", "d": "-D", "b": "--back",
|
||||
"force4": "-4", "force6": "-6", "dnf": "-F", "icmp": "-I", "tcp": "-T", "nodns": "-n", "udp": "-U", "udplite": "-UL", "dccp": "-D", "back": "--back",
|
||||
}
|
||||
var defaultopts []string
|
||||
//defaultopts = append(defaultopts) // no default options for traceroute
|
||||
res := prerunner(req, cmd, cmdopts, defaultopts)
|
||||
|
Loading…
Reference in New Issue
Block a user