From c3b51710dea9710dc1e4ea3502acfe0fec52b5c7 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Fri, 31 Dec 2021 12:59:19 +0000 Subject: [PATCH] disable fullcone capture packetaddr capture on connection with forward proxy --- app/proxyman/outbound/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/proxyman/outbound/handler.go b/app/proxyman/outbound/handler.go index 27186f78f..bdbbef8ec 100644 --- a/app/proxyman/outbound/handler.go +++ b/app/proxyman/outbound/handler.go @@ -202,14 +202,15 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn outbound.Gateway = h.senderSettings.Via.AsAddress() } } - + var enablePacketAddrCapture = true if h.senderSettings != nil && h.senderSettings.ProxySettings != nil && h.senderSettings.ProxySettings.HasTag() && h.senderSettings.ProxySettings.TransportLayerProxy { tag := h.senderSettings.ProxySettings.Tag newError("transport layer proxying to ", tag, " for dest ", dest).AtDebug().WriteToLog(session.ExportIDToError(ctx)) ctx = session.SetTransportLayerProxyTagToContext(ctx, tag) + enablePacketAddrCapture = false } - if isStream, err := packetaddr.GetDestinationSubsetOf(dest); err == nil { + if isStream, err := packetaddr.GetDestinationSubsetOf(dest); err == nil && enablePacketAddrCapture { packetConn, err := internet.ListenSystemPacket(ctx, &net.UDPAddr{IP: net.AnyIP.IP(), Port: 0}, h.streamSettings.SocketSettings) if err != nil { return nil, newError("unable to listen socket").Base(err)