mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-06-07 11:39:11 -04:00
support for http and tls header sniffing
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/app/log"
|
||||
"v2ray.com/core/app/proxyman"
|
||||
"v2ray.com/core/common/buf"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/proxy"
|
||||
@@ -33,6 +34,7 @@ type tcpWorker struct {
|
||||
recvOrigDest bool
|
||||
tag string
|
||||
dispatcher dispatcher.Interface
|
||||
sniffers []proxyman.KnownProtocols
|
||||
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
@@ -55,6 +57,9 @@ func (w *tcpWorker) callback(conn internet.Connection) {
|
||||
}
|
||||
ctx = proxy.ContextWithInboundEntryPoint(ctx, v2net.TCPDestination(w.address, w.port))
|
||||
ctx = proxy.ContextWithSource(ctx, v2net.DestinationFromAddr(conn.RemoteAddr()))
|
||||
if len(w.sniffers) > 0 {
|
||||
ctx = proxyman.ContextWithProtocolSniffers(ctx, w.sniffers)
|
||||
}
|
||||
if err := w.proxy.Process(ctx, v2net.Network_TCP, conn, w.dispatcher); err != nil {
|
||||
log.Trace(newError("connection ends").Base(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user