feat: sniffer support
sniffer: enable: true force: false # Overwrite domain sniffing: - tls
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"github.com/Dreamacro/clash/component/nat"
|
||||
P "github.com/Dreamacro/clash/component/process"
|
||||
"github.com/Dreamacro/clash/component/resolver"
|
||||
"github.com/Dreamacro/clash/component/sniffer"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"github.com/Dreamacro/clash/constant/provider"
|
||||
icontext "github.com/Dreamacro/clash/context"
|
||||
@ -36,6 +37,8 @@ var (
|
||||
|
||||
// default timeout for UDP session
|
||||
udpTimeout = 60 * time.Second
|
||||
|
||||
snifferDispatcher *sniffer.SnifferDispatcher
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -294,6 +297,10 @@ func handleTCPConn(connCtx C.ConnContext) {
|
||||
return
|
||||
}
|
||||
|
||||
if sniffer.Dispatcher.Enable() {
|
||||
sniffer.Dispatcher.Tcp(connCtx.Conn(), metadata)
|
||||
}
|
||||
|
||||
proxy, rule, err := resolveMetadata(connCtx, metadata)
|
||||
if err != nil {
|
||||
log.Warnln("[Metadata] parse failed: %s", err.Error())
|
||||
|
Reference in New Issue
Block a user