fix: udp listen use udp4 when general.ipv6 is false; general.ipv6 default value is true

This commit is contained in:
Skyxim
2022-06-14 12:35:24 +08:00
parent f7481ecadf
commit c968104a19
2 changed files with 6 additions and 0 deletions

View File

@ -57,6 +57,10 @@ func ListenPacket(ctx context.Context, network, address string, options ...Optio
o(cfg)
}
if DisableIPv6 {
network = "udp4"
}
lc := &net.ListenConfig{}
if cfg.interfaceName != "" {
addr, err := bindIfaceToListenConfig(cfg.interfaceName, lc, network, address)