chore: better source address

This commit is contained in:
gVisor bot 2023-01-25 13:00:18 +08:00
parent 9c99f60a57
commit 96800e65ee

View file

@ -304,12 +304,12 @@ func handleUDPConn(packet C.PacketAdapter) {
log.Warnln( log.Warnln(
"[UDP] dial %s %s --> %s error: %s", "[UDP] dial %s %s --> %s error: %s",
proxy.Name(), proxy.Name(),
metadata.SourceAddress(), metadata.SourceDetail(),
metadata.RemoteAddress(), metadata.RemoteAddress(),
err.Error(), err.Error(),
) )
} else { } 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 { if err != nil {
@ -321,7 +321,7 @@ func handleUDPConn(packet C.PacketAdapter) {
switch true { switch true {
case metadata.SpecialProxy != "": 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: case rule != nil:
if rule.Payload() != "" { 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()) 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( log.Warnln(
"[TCP] dial %s %s --> %s error: %s", "[TCP] dial %s %s --> %s error: %s",
proxy.Name(), proxy.Name(),
metadata.SourceAddress(), metadata.SourceDetail(),
metadata.RemoteAddress(), metadata.RemoteAddress(),
err.Error(), err.Error(),
) )
} else { } 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 { if err != nil {
@ -409,7 +409,7 @@ func handleTCPConn(connCtx C.ConnContext) {
switch true { switch true {
case metadata.SpecialProxy != "": 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: case rule != nil:
if rule.Payload() != "" { 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()) 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: default:
log.Infoln( log.Infoln(
"[TCP] %s --> %s doesn't match any rule using DIRECT", "[TCP] %s --> %s doesn't match any rule using DIRECT",
metadata.SourceAddress(), metadata.SourceDetail(),
metadata.RemoteAddress(), metadata.RemoteAddress(),
) )
} }