copy inbound

This commit is contained in:
Fangliding
2026-06-17 20:53:43 +08:00
parent b4cfe4f122
commit 325b57dc24
+6 -3
View File
@@ -229,10 +229,13 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn stat.Connection, dis
}
changeRemote.Do(func() {
if inbound != nil {
newInbound := *inbound
// change source to real remote UDP address
inbound.Source = net.DestinationFromAddr(conn.RemoteAddr())
inbound.Local = net.DestinationFromAddr(conn.LocalAddr())
errors.LogInfo(ctx, "client UDP connection from ", inbound.Source)
newInbound.Source = net.DestinationFromAddr(conn.RemoteAddr())
newInbound.Local = net.DestinationFromAddr(conn.LocalAddr())
inbound = &newInbound
ctx = session.ContextWithInbound(ctx, &newInbound)
errors.LogInfo(ctx, "client UDP connection from ", newInbound.Source)
}
})