Fix: should not log rule when rule = nil
This commit is contained in:
parent
bea2ee8bf2
commit
994cbff215
1 changed files with 10 additions and 2 deletions
|
@ -218,7 +218,11 @@ func handleUDPConn(packet *inbound.PacketAdapter) {
|
||||||
|
|
||||||
rawPc, err := proxy.DialUDP(metadata)
|
rawPc, err := proxy.DialUDP(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if rule == nil {
|
||||||
|
log.Warnln("[UDP] dial %s to %s error: %s", proxy.Name(), metadata.String(), err.Error())
|
||||||
|
} else {
|
||||||
log.Warnln("[UDP] dial %s (match %s/%s) to %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.String(), err.Error())
|
log.Warnln("[UDP] dial %s (match %s/%s) to %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.String(), err.Error())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pc := newUDPTracker(rawPc, DefaultManager, metadata, rule)
|
pc := newUDPTracker(rawPc, DefaultManager, metadata, rule)
|
||||||
|
@ -263,7 +267,11 @@ func handleTCPConn(localConn C.ServerAdapter) {
|
||||||
|
|
||||||
remoteConn, err := proxy.Dial(metadata)
|
remoteConn, err := proxy.Dial(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if rule == nil {
|
||||||
|
log.Warnln("[TCP] dial %s to %s error: %s", proxy.Name(), metadata.String(), err.Error())
|
||||||
|
} else {
|
||||||
log.Warnln("[TCP] dial %s (match %s/%s) to %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.String(), err.Error())
|
log.Warnln("[TCP] dial %s (match %s/%s) to %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.String(), err.Error())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
remoteConn = newTCPTracker(remoteConn, DefaultManager, metadata, rule)
|
remoteConn = newTCPTracker(remoteConn, DefaultManager, metadata, rule)
|
||||||
|
|
Loading…
Reference in a new issue