Fix: net.Address type checking (#1629)

Allow zero port for listening port, namely random port.
This commit is contained in:
1ocalhost
2022-04-06 13:42:25 +08:00
committed by GitHub
parent 7bcb3c901b
commit 64a780bba6
+1 -1
View File
@@ -39,7 +39,7 @@ func ListenTCP(ctx context.Context, address net.Address, port net.Port, streamSe
}
var listener net.Listener
var err error
if port == net.Port(0) { // unix
if address.Family().IsDomain() {
listener, err = internet.ListenSystem(ctx, &net.UnixAddr{
Name: address.Domain(),
Net: "unix",