Skip to content

Commit

Permalink
feat: add ping
Browse files Browse the repository at this point in the history
  • Loading branch information
kleicht committed Mar 8, 2018
1 parent 2fb3957 commit bdb860b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ func copyHeader(dst, src http.Header) {
}
}
}

func handlePing(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusOK)
}

func main() {
var port int
flag.IntVar(&port, "port", 8888, "port")
Expand All @@ -64,6 +69,10 @@ func main() {
server := &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%d", port),
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet && r.URL.Path == "/ping" {
handlePing(w, r)
return
}
if r.Method == http.MethodConnect {
handleTunneling(w, r)
} else {
Expand Down

0 comments on commit bdb860b

Please sign in to comment.