|
|
@ -9,16 +9,17 @@ import (
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"golang.org/x/net/http2"
|
|
|
|
|
|
|
|
"golang.org/x/net/http2/h2c"
|
|
|
|
|
|
|
|
|
|
|
|
"v2ray.com/core/common"
|
|
|
|
"v2ray.com/core/common"
|
|
|
|
"v2ray.com/core/common/net"
|
|
|
|
"v2ray.com/core/common/net"
|
|
|
|
|
|
|
|
http_proto "v2ray.com/core/common/protocol/http"
|
|
|
|
"v2ray.com/core/common/serial"
|
|
|
|
"v2ray.com/core/common/serial"
|
|
|
|
"v2ray.com/core/common/session"
|
|
|
|
"v2ray.com/core/common/session"
|
|
|
|
"v2ray.com/core/common/signal/done"
|
|
|
|
"v2ray.com/core/common/signal/done"
|
|
|
|
"v2ray.com/core/transport/internet"
|
|
|
|
"v2ray.com/core/transport/internet"
|
|
|
|
"v2ray.com/core/transport/internet/tls"
|
|
|
|
"v2ray.com/core/transport/internet/tls"
|
|
|
|
|
|
|
|
|
|
|
|
"golang.org/x/net/http2"
|
|
|
|
|
|
|
|
"golang.org/x/net/http2/h2c"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Listener struct {
|
|
|
|
type Listener struct {
|
|
|
@ -82,6 +83,11 @@ func (l *Listener) ServeHTTP(writer http.ResponseWriter, request *http.Request)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forwardedAddrs := http_proto.ParseXForwardedFor(request.Header)
|
|
|
|
|
|
|
|
if len(forwardedAddrs) > 0 && forwardedAddrs[0].Family().IsIP() {
|
|
|
|
|
|
|
|
remoteAddr.(*net.TCPAddr).IP = forwardedAddrs[0].IP()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
done := done.New()
|
|
|
|
done := done.New()
|
|
|
|
conn := net.NewConnection(
|
|
|
|
conn := net.NewConnection(
|
|
|
|
net.ConnectionOutput(request.Body),
|
|
|
|
net.ConnectionOutput(request.Body),
|
|
|
|