From de23e51077d34937229c3997586aaa99634df409 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Sat, 16 Aug 2025 19:12:59 +0000 Subject: [PATCH] DNS outbound: Set "reject" as the default value for `nonIPQuery` https://github.com/XTLS/Xray-core/pull/4903#issuecomment-3091367130 --- infra/conf/dns_proxy.go | 4 +--- infra/conf/dns_proxy_test.go | 1 - proxy/dns/dns.go | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infra/conf/dns_proxy.go b/infra/conf/dns_proxy.go index e731ee7c..b223e502 100644 --- a/infra/conf/dns_proxy.go +++ b/infra/conf/dns_proxy.go @@ -28,9 +28,7 @@ func (c *DNSOutboundConfig) Build() (proto.Message, error) { config.Server.Address = c.Address.Build() } switch c.NonIPQuery { - case "": - c.NonIPQuery = "drop" - case "drop", "skip", "reject": + case "", "reject", "drop", "skip": default: return nil, errors.New(`unknown "nonIPQuery": `, c.NonIPQuery) } diff --git a/infra/conf/dns_proxy_test.go b/infra/conf/dns_proxy_test.go index 5c5dfecd..805ac323 100644 --- a/infra/conf/dns_proxy_test.go +++ b/infra/conf/dns_proxy_test.go @@ -27,7 +27,6 @@ func TestDnsProxyConfig(t *testing.T) { Address: net.NewIPOrDomain(net.IPAddress([]byte{8, 8, 8, 8})), Port: 53, }, - Non_IPQuery: "drop", }, }, }) diff --git a/proxy/dns/dns.go b/proxy/dns/dns.go index 0f83f5ac..40db53a8 100644 --- a/proxy/dns/dns.go +++ b/proxy/dns/dns.go @@ -65,6 +65,9 @@ func (h *Handler) Init(config *Config, dnsClient dns.Client, policyManager polic h.server = config.Server.AsDestination() } h.nonIPQuery = config.Non_IPQuery + if h.nonIPQuery == "" { + h.nonIPQuery = "reject" + } h.blockTypes = config.BlockTypes return nil }