chore: better source address

This commit is contained in:
Skyxim 2023-01-25 13:00:18 +08:00
parent 9a4be1fbec
commit a563e9375e

View File

@ -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(),
)
}