From 7a02cb83a71bb8efd09ae18eb6a1d581ab381f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 28 Nov 2022 11:47:56 +0800 Subject: [PATCH] Revert "Fix listen packet on address" This reverts commit d1fe17a4db1e444485fede62499135d95ce8c661. --- common/dialer/default.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/common/dialer/default.go b/common/dialer/default.go index 8ab080eb..d46bd2e5 100644 --- a/common/dialer/default.go +++ b/common/dialer/default.go @@ -175,13 +175,9 @@ func (d *DefaultDialer) DialContext(ctx context.Context, network string, address } func (d *DefaultDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) { - var destinationString string - if destination.IsValid() && !destination.Addr.IsUnspecified() { - destinationString = destination.String() - } else if !destination.IsIPv6() { - destinationString = d.udpAddr4 + if !destination.IsIPv6() { + return d.udpListener.ListenPacket(ctx, N.NetworkUDP, d.udpAddr4) } else { - destinationString = d.udpAddr6 + return d.udpListener.ListenPacket(ctx, N.NetworkUDP, d.udpAddr6) } - return d.udpListener.ListenPacket(ctx, N.NetworkUDP, destinationString) }