mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-24 15:34:54 +00:00
add fallback to request if it fails
This commit is contained in:
parent
9af6ed7b41
commit
2b54af9b4b
4
main.go
4
main.go
@ -52,7 +52,11 @@ func ping(w http.ResponseWriter, req *http.Request) {
|
||||
geturl := strings.Split(req.URL.String(), "/")
|
||||
target := geturl[2]
|
||||
pingres := runner(req.RemoteAddr, "ping", "-c5", target)
|
||||
if pingres != "" {
|
||||
fmt.Fprintln(w, pingres)
|
||||
} else {
|
||||
fmt.Fprintln(w, http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
Loading…
Reference in New Issue
Block a user