From a563e9375e18ad85e3a92aac1e56f3eaff6d78b4 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Wed, 25 Jan 2023 13:00:18 +0800 Subject: [PATCH] chore: better source address --- tunnel/tunnel.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 0cc045c3..9c6c155f 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -304,12 +304,12 @@ func handleUDPConn(packet C.PacketAdapter) { log.Warnln( "[UDP] dial %s %s --> %s error: %s", proxy.Name(), - metadata.SourceAddress(), + metadata.SourceDetail(), metadata.RemoteAddress(), err.Error(), ) } else { - log.Warnln("[UDP] dial %s (match %s/%s) %s --> %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.SourceAddress(), metadata.RemoteAddress(), err.Error()) + log.Warnln("[UDP] dial %s (match %s/%s) %s --> %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.SourceDetail(), metadata.RemoteAddress(), err.Error()) } }) if err != nil { @@ -321,7 +321,7 @@ func handleUDPConn(packet C.PacketAdapter) { switch true { case metadata.SpecialProxy != "": - log.Infoln("[UDP] %s --> %s using %s", metadata.SourceAddress(), metadata.RemoteAddress(), metadata.SpecialProxy) + log.Infoln("[UDP] %s --> %s using %s", metadata.SourceDetail(), metadata.RemoteAddress(), metadata.SpecialProxy) case rule != nil: if rule.Payload() != "" { log.Infoln("[UDP] %s --> %s match %s using %s", metadata.SourceDetail(), metadata.RemoteAddress(), fmt.Sprintf("%s(%s)", rule.RuleType().String(), rule.Payload()), rawPc.Chains().String()) @@ -390,12 +390,12 @@ func handleTCPConn(connCtx C.ConnContext) { log.Warnln( "[TCP] dial %s %s --> %s error: %s", proxy.Name(), - metadata.SourceAddress(), + metadata.SourceDetail(), metadata.RemoteAddress(), err.Error(), ) } else { - log.Warnln("[TCP] dial %s (match %s/%s) %s --> %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.SourceAddress(), metadata.RemoteAddress(), err.Error()) + log.Warnln("[TCP] dial %s (match %s/%s) %s --> %s error: %s", proxy.Name(), rule.RuleType().String(), rule.Payload(), metadata.SourceDetail(), metadata.RemoteAddress(), err.Error()) } }) if err != nil { @@ -409,7 +409,7 @@ func handleTCPConn(connCtx C.ConnContext) { switch true { case metadata.SpecialProxy != "": - log.Infoln("[TCP] %s --> %s using %s", metadata.SourceAddress(), metadata.RemoteAddress(), metadata.SpecialProxy) + log.Infoln("[TCP] %s --> %s using %s", metadata.SourceDetail(), metadata.RemoteAddress(), metadata.SpecialProxy) case rule != nil: if rule.Payload() != "" { log.Infoln("[TCP] %s --> %s match %s using %s", metadata.SourceDetail(), metadata.RemoteAddress(), fmt.Sprintf("%s(%s)", rule.RuleType().String(), rule.Payload()), remoteConn.Chains().String()) @@ -423,7 +423,7 @@ func handleTCPConn(connCtx C.ConnContext) { default: log.Infoln( "[TCP] %s --> %s doesn't match any rule using DIRECT", - metadata.SourceAddress(), + metadata.SourceDetail(), metadata.RemoteAddress(), ) }