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)

View File

@ -254,6 +254,7 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) {
rawCfg := &RawConfig{
AllowLan: false,
BindAddress: "*",
IPv6: true,
Mode: T.Rule,
GeodataMode: C.GeodataMode,
GeodataLoader: "memconservative",
@ -281,6 +282,7 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) {
},
DNS: RawDNS{
Enable: false,
IPv6: false,
UseHosts: true,
EnhancedMode: C.DNSMapping,
FakeIPRange: "198.18.0.1/16",