revert to always dig
parent
512dc9fcd5
commit
899f42d5f8
17
server.go
17
server.go
|
|
@ -9,8 +9,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -98,25 +96,10 @@ func (s *Server) Connect(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
|
|
||||||
go s.xfer(r.Context(), dest, client)
|
go s.xfer(r.Context(), dest, client)
|
||||||
go s.xfer(r.Context(), client, dest)
|
go s.xfer(r.Context(), client, dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) connectHTTPReverseProxy(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if r.URL.Scheme == "" {
|
|
||||||
r.URL.Scheme = "https"
|
|
||||||
r.URL.Host = strings.TrimSuffix(r.URL.Host, ":443")
|
|
||||||
}
|
|
||||||
log.Printf("connectHTTPReverseProxy(%+v)", r.URL)
|
|
||||||
httputil.NewSingleHostReverseProxy(&url.URL{
|
|
||||||
Scheme: r.URL.Scheme,
|
|
||||||
Host: r.URL.Host,
|
|
||||||
Path: "/",
|
|
||||||
}).ServeHTTP(w, r)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) Serve(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) Serve(w http.ResponseWriter, r *http.Request) {
|
||||||
resp, err := s.Transport.RoundTrip(r)
|
resp, err := s.Transport.RoundTrip(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue