chore: Adjust the tcp-concurrent and sniffer log
This commit is contained in:
@ -238,8 +238,7 @@ func concurrentDialContext(ctx context.Context, network, address string, opt *op
|
||||
if ip.Is6() {
|
||||
v = "6"
|
||||
}
|
||||
|
||||
log.Debugln("[%s] try use [%s] connected", host, ip.String())
|
||||
//log.Debugln("[%s] try use [%s] connected", host, ip.String())
|
||||
result.Conn, result.error = dialContext(ctx, network+v, ip, port, opt)
|
||||
}
|
||||
|
||||
@ -255,12 +254,11 @@ func concurrentDialContext(ctx context.Context, network, address string, opt *op
|
||||
return res.Conn, nil
|
||||
}
|
||||
|
||||
log.Errorln("connect error:%v", res.error)
|
||||
//log.Errorln("connect error:%v", res.error)
|
||||
if connCount == 0 {
|
||||
log.Errorln("connect [%s] all ip failed", host)
|
||||
//log.Errorln("connect [%s] all ip failed", host)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errors.New("all ip tcp shakeHands failed")
|
||||
}
|
||||
|
@ -23,15 +23,17 @@ var (
|
||||
|
||||
var Dispatcher SnifferDispatcher
|
||||
|
||||
type SnifferDispatcher struct {
|
||||
enable bool
|
||||
type (
|
||||
SnifferDispatcher struct {
|
||||
enable bool
|
||||
|
||||
sniffers []C.Sniffer
|
||||
sniffers []C.Sniffer
|
||||
|
||||
foreDomain *trie.DomainTrie[bool]
|
||||
skipSNI *trie.DomainTrie[bool]
|
||||
portRanges *[]utils.Range[uint16]
|
||||
}
|
||||
foreDomain *trie.DomainTrie[bool]
|
||||
skipSNI *trie.DomainTrie[bool]
|
||||
portRanges *[]utils.Range[uint16]
|
||||
}
|
||||
)
|
||||
|
||||
func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) {
|
||||
bufConn, ok := conn.(*CN.BufferedConn)
|
||||
@ -98,18 +100,17 @@ func (sd *SnifferDispatcher) sniffDomain(conn *CN.BufferedConn, metadata *C.Meta
|
||||
if err != nil {
|
||||
_, ok := err.(*net.OpError)
|
||||
if ok {
|
||||
log.Errorln("[Sniffer] [%s] Maybe read timeout, Consider adding skip", metadata.DstIP.String())
|
||||
//log.Errorln("[Sniffer] [%s] Maybe read timeout, Consider adding skip", metadata.DstIP.String())
|
||||
conn.Close()
|
||||
}
|
||||
|
||||
log.Errorln("[Sniffer] %v", err)
|
||||
//log.Errorln("[Sniffer] %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
bufferedLen := conn.Buffered()
|
||||
bytes, err := conn.Peek(bufferedLen)
|
||||
if err != nil {
|
||||
log.Debugln("[Sniffer] the data length not enough")
|
||||
//log.Debugln("[Sniffer] the data length not enough")
|
||||
continue
|
||||
}
|
||||
|
||||
@ -146,7 +147,7 @@ func NewSnifferDispatcher(needSniffer []C.SnifferType, forceDomain *trie.DomainT
|
||||
for _, snifferName := range needSniffer {
|
||||
sniffer, err := NewSniffer(snifferName)
|
||||
if err != nil {
|
||||
log.Errorln("Sniffer name[%s] is error", snifferName)
|
||||
//log.Errorln("Sniffer name[%s] is error", snifferName)
|
||||
return &SnifferDispatcher{enable: false}, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user