fix: RefineSourceToShow should use dst instead of destToSend

This commit is contained in:
mzz2017
2023-02-10 16:38:36 +08:00
parent bd55d76753
commit 61014019de
3 changed files with 7 additions and 6 deletions

View File

@ -154,7 +154,7 @@ func (c *ControlPlane) handlePkt(data []byte, src, dst netip.AddrPort, outboundI
if c.log.IsLevelEnabled(logrus.DebugLevel) && len(dnsMessage.Questions) > 0 {
q := dnsMessage.Questions[0]
c.log.Tracef("UDP(DNS) %v <-[%v]-> Cache: %v %v",
RefineSourceToShow(src, destToSend.Addr()), outbound.Name, strings.ToLower(q.Name.String()), q.Type,
RefineSourceToShow(src, dst.Addr()), outbound.Name, strings.ToLower(q.Name.String()), q.Type,
)
}
return nil
@ -273,7 +273,7 @@ func (c *ControlPlane) handlePkt(data []byte, src, dst netip.AddrPort, outboundI
// If the udp endpoint has been not alive, remove it from pool and get a new one.
if !isNew && !ue.Dialer.MustGetAlive(l4proto, ipversion) {
c.log.WithFields(logrus.Fields{
"src": src.String(),
"src": RefineSourceToShow(src, dst.Addr()),
"network": string(l4proto) + string(ipversion),
"dialer": ue.Dialer.Name(),
}).Debugln("Old udp endpoint is not alive and removed")
@ -342,7 +342,7 @@ func (c *ControlPlane) handlePkt(data []byte, src, dst netip.AddrPort, outboundI
"qname": strings.ToLower(q.Name.String()),
"qtype": q.Type,
}).Infof("%v <-> %v",
RefineSourceToShow(src, destToSend.Addr()), RefineAddrPortToShow(destToSend),
RefineSourceToShow(src, dst.Addr()), RefineAddrPortToShow(destToSend),
)
} else {
// TODO: Set-up ip to domain mapping and show domain if possible.
@ -351,7 +351,7 @@ func (c *ControlPlane) handlePkt(data []byte, src, dst netip.AddrPort, outboundI
"outbound": outbound.Name,
"dialer": realDialer.Name(),
}).Infof("%v <-> %v",
RefineSourceToShow(src, destToSend.Addr()), RefineAddrPortToShow(destToSend),
RefineSourceToShow(src, dst.Addr()), RefineAddrPortToShow(destToSend),
)
}
}