mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-14 19:23:14 +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(), "/")
|
geturl := strings.Split(req.URL.String(), "/")
|
||||||
target := geturl[2]
|
target := geturl[2]
|
||||||
pingres := runner(req.RemoteAddr, "ping", "-c5", target)
|
pingres := runner(req.RemoteAddr, "ping", "-c5", target)
|
||||||
|
if pingres != "" {
|
||||||
fmt.Fprintln(w, pingres)
|
fmt.Fprintln(w, pingres)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintln(w, http.StatusInternalServerError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user