mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-21 14:23:15 +00:00
add fallback to request if it fails
This commit is contained in:
parent
9af6ed7b41
commit
2b54af9b4b
6
main.go
6
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)
|
||||
fmt.Fprintln(w, pingres)
|
||||
if pingres != "" {
|
||||
fmt.Fprintln(w, pingres)
|
||||
} else {
|
||||
fmt.Fprintln(w, http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
Loading…
Reference in New Issue
Block a user