1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

generate alert instead of panic when encountering incorrect listen on port 0 on IPv4 or v6 address (#3172)

This commit is contained in:
Xiaokang Wang (Shelikhoo) 2024-10-01 19:33:50 +01:00 committed by GitHub
parent b921dcad6c
commit 5ca0f36743
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,9 @@ func ListenWithSecuritySettings(ctx context.Context, address net.Address, port n
transportListener := transportEnvironment.Listener()
if port == net.Port(0) { // unix
if !address.Family().IsDomain() {
return nil, newError("invalid address for unix domain socket: ", address)
}
listener, err := transportListener.Listen(ctx, &net.UnixAddr{
Name: address.Domain(),
Net: "unix",