add debug output

This commit is contained in:
xuu 2021-08-26 20:55:42 +00:00
parent 59a0e9bb44
commit 784ecf0399
No known key found for this signature in database
GPG Key ID: 1601E16A9C4D8A22

10
main.go
View File

@ -116,6 +116,12 @@ func (srv *server) newSession(ctx context.Context) func(ssh.Session) {
req.Header.Set("X-Origin-Host", host)
req.URL.Scheme = "http"
req.URL.Host = host
requestDump, err := httputil.DumpRequest(req, req.Method == http.MethodPost || req.Method == http.MethodPut)
if err != nil {
fmt.Println(err)
}
fmt.Fprintln(s, string(requestDump))
}
u.proxy = &httputil.ReverseProxy{Director: director}
fmt.Fprintf(s, "Created HTTP listener at: %v%v\n", u.name, srv.domainSuffix)
@ -308,6 +314,7 @@ func (srv *server) handleHTTP(rw http.ResponseWriter, r *http.Request) {
if !ok || u.proxy == nil {
fmt.Fprintln(rw, "NOT FOUND", name)
}
u.proxy.ServeHTTP(rw, r)
return
}
@ -427,8 +434,11 @@ func (m *serverMux) Serve(ctx context.Context) error {
}
}
<<<<<<< Updated upstream
func fingerprintHuman(pubKey ssh.PublicKey) string {
sha256sum := sha256.Sum256(pubKey.Marshal())
h, _ := humanhash.Humanize(sha256sum[:], 3)
return h
}
=======
>>>>>>> Stashed changes