mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +00:00
Fix listen packet on address
This commit is contained in:
parent
7c910165ef
commit
d1fe17a4db
|
@ -175,9 +175,13 @@ func (d *DefaultDialer) DialContext(ctx context.Context, network string, address
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DefaultDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
|
func (d *DefaultDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
|
||||||
if !destination.IsIPv6() {
|
var destinationString string
|
||||||
return d.udpListener.ListenPacket(ctx, N.NetworkUDP, d.udpAddr4)
|
if destination.IsValid() && !destination.Addr.IsUnspecified() {
|
||||||
|
destinationString = destination.String()
|
||||||
|
} else if !destination.IsIPv6() {
|
||||||
|
destinationString = d.udpAddr4
|
||||||
} else {
|
} else {
|
||||||
return d.udpListener.ListenPacket(ctx, N.NetworkUDP, d.udpAddr6)
|
destinationString = d.udpAddr6
|
||||||
}
|
}
|
||||||
|
return d.udpListener.ListenPacket(ctx, N.NetworkUDP, destinationString)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue