mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-22 17:46:48 +08:00
DNS outbound: Set "reject" as the default value for nonIPQuery
https://github.com/XTLS/Xray-core/pull/4903#issuecomment-3091367130
This commit is contained in:
@@ -28,9 +28,7 @@ func (c *DNSOutboundConfig) Build() (proto.Message, error) {
|
|||||||
config.Server.Address = c.Address.Build()
|
config.Server.Address = c.Address.Build()
|
||||||
}
|
}
|
||||||
switch c.NonIPQuery {
|
switch c.NonIPQuery {
|
||||||
case "":
|
case "", "reject", "drop", "skip":
|
||||||
c.NonIPQuery = "drop"
|
|
||||||
case "drop", "skip", "reject":
|
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(`unknown "nonIPQuery": `, c.NonIPQuery)
|
return nil, errors.New(`unknown "nonIPQuery": `, c.NonIPQuery)
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,6 @@ func TestDnsProxyConfig(t *testing.T) {
|
|||||||
Address: net.NewIPOrDomain(net.IPAddress([]byte{8, 8, 8, 8})),
|
Address: net.NewIPOrDomain(net.IPAddress([]byte{8, 8, 8, 8})),
|
||||||
Port: 53,
|
Port: 53,
|
||||||
},
|
},
|
||||||
Non_IPQuery: "drop",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@@ -65,6 +65,9 @@ func (h *Handler) Init(config *Config, dnsClient dns.Client, policyManager polic
|
|||||||
h.server = config.Server.AsDestination()
|
h.server = config.Server.AsDestination()
|
||||||
}
|
}
|
||||||
h.nonIPQuery = config.Non_IPQuery
|
h.nonIPQuery = config.Non_IPQuery
|
||||||
|
if h.nonIPQuery == "" {
|
||||||
|
h.nonIPQuery = "reject"
|
||||||
|
}
|
||||||
h.blockTypes = config.BlockTypes
|
h.blockTypes = config.BlockTypes
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user