fix everything forever
This commit is contained in:
parent
70191a0b88
commit
4021b4f3aa
|
@ -26,7 +26,7 @@ func main() {
|
|||
|
||||
func handle(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "Route is go!")
|
||||
fmt.Fprintf(w, "%s\n", pretty.Sprint(r.Header))
|
||||
fmt.Fprintf(w, "%s\n", pretty.Sprintf("%s", r.Header))
|
||||
hn, _ := os.Hostname()
|
||||
fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS)
|
||||
fmt.Fprintf(w, "Hit count: %d", hits.Inc())
|
||||
|
|
|
@ -21,7 +21,7 @@ func main() {
|
|||
|
||||
cfg := &tun2.ClientConfig{
|
||||
TLSConfig: &tls.Config{},
|
||||
ConnType: "kcp",
|
||||
ConnType: "tcp",
|
||||
ServerAddr: *serverAddr,
|
||||
Token: *token,
|
||||
Domain: *domain,
|
||||
|
|
|
@ -272,6 +272,10 @@ func (s *Server) HandleConn(c net.Conn, isKCP bool) {
|
|||
"id": connection.id,
|
||||
})
|
||||
|
||||
controlStream.Close()
|
||||
session.Close()
|
||||
c.Close()
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -296,6 +300,8 @@ func (s *Server) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||
"uri": req.RequestURI,
|
||||
})
|
||||
|
||||
c.cancel()
|
||||
|
||||
return nil, err
|
||||
}
|
||||
defer stream.Close()
|
||||
|
@ -310,6 +316,8 @@ func (s *Server) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||
"uri": req.RequestURI,
|
||||
})
|
||||
|
||||
c.cancel()
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -325,6 +333,8 @@ func (s *Server) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||
"uri": req.RequestURI,
|
||||
})
|
||||
|
||||
c.cancel()
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ func (s *Server) Director(r *http.Request) {
|
|||
|
||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
r.Header.Del("X-Forwarded-For")
|
||||
r.Header.Del("X-Client-Ip")
|
||||
|
||||
if r.Header.Get("X-Tor2web") != "" {
|
||||
http.Error(w, "tor2web proxy use is not allowed", 400)
|
||||
|
@ -178,9 +179,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
r.Header.Set("X-Forwarded-For", host)
|
||||
r.Header.Set("X-Remote-IP", host)
|
||||
r.Header.Set("X-Request-Ingress", time.Now().String())
|
||||
r.Header.Set("X-Remote-Ip", host)
|
||||
r.Header.Set("X-Request-Ingress", time.Now().Format(time.RFC3339))
|
||||
|
||||
rid := ulid.New().String()
|
||||
r.Header.Set("X-Request-Id", rid)
|
||||
|
|
Loading…
Reference in New Issue