mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-27 12:24:14 +00:00
UDP listener: Allow listening on "localhost" (#4940)
Fixes https://github.com/XTLS/Xray-core/issues/4939
This commit is contained in:
parent
cfcf2a63d1
commit
1ea00fad81
1 changed files with 8 additions and 0 deletions
|
@ -40,6 +40,14 @@ func ListenUDP(ctx context.Context, address net.Address, port net.Port, streamSe
|
||||||
opt(hub)
|
opt(hub)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if address.Family().IsDomain() && address.Domain() == "localhost" {
|
||||||
|
address = net.LocalHostIP
|
||||||
|
}
|
||||||
|
|
||||||
|
if address.Family().IsDomain() {
|
||||||
|
return nil, errors.New("domain address is not allowed for listening: ", address.Domain())
|
||||||
|
}
|
||||||
|
|
||||||
var sockopt *internet.SocketConfig
|
var sockopt *internet.SocketConfig
|
||||||
if streamSettings != nil {
|
if streamSettings != nil {
|
||||||
sockopt = streamSettings.SocketSettings
|
sockopt = streamSettings.SocketSettings
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue