Revert "Fix listen packet on address"

This reverts commit d1fe17a4db.
This commit is contained in:
世界 2022-11-28 11:47:56 +08:00
parent 51ce672076
commit 7a02cb83a7
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

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