Feature: make tls sni sniffing switch config
This commit is contained in:
@@ -38,6 +38,9 @@ var (
|
||||
// Outbound Rule
|
||||
mode = Rule
|
||||
|
||||
// sniffing switch
|
||||
sniffing = false
|
||||
|
||||
// default timeout for UDP session
|
||||
udpTimeout = 60 * time.Second
|
||||
|
||||
@@ -99,6 +102,14 @@ func SetMode(m TunnelMode) {
|
||||
mode = m
|
||||
}
|
||||
|
||||
func Sniffing() bool {
|
||||
return sniffing
|
||||
}
|
||||
|
||||
func SetSniffing(s bool) {
|
||||
sniffing = s
|
||||
}
|
||||
|
||||
// SetMitmOutbound set the MITM outbound
|
||||
func SetMitmOutbound(outbound C.ProxyAdapter) {
|
||||
if outbound != nil {
|
||||
@@ -341,6 +352,9 @@ func handleTCPConn(connCtx C.ConnContext) {
|
||||
|
||||
if remoteConn.Chains().Last() != "REJECT" && !isMitmOutbound {
|
||||
remoteConn = statistic.NewTCPTracker(remoteConn, statistic.DefaultManager, metadata, rule)
|
||||
if sniffing {
|
||||
remoteConn = statistic.NewSniffing(remoteConn, metadata, rule)
|
||||
}
|
||||
}
|
||||
|
||||
defer func(remoteConn C.Conn) {
|
||||
|
||||
Reference in New Issue
Block a user