DNS Server
Surge uses a customized DNS client to support advanced features. It may behave differently from the DNS client of your operating system.
Upstream DNS Server
Surge uses DNS server addresses from the operating system by default. You can override them with the dns-server parameter.
[General]
dns-server = 8.8.8.8, 8.8.4.4
Use the keyword system to include the system DNS servers together with custom servers. Duplicate servers are ignored.
[General]
dns-server = system, 8.8.8.8, 8.8.4.4
Technical Details
Surge queries all DNS servers simultaneously to improve performance, similar to dnsmasq with the --all-servers parameter. The first answer is used. Surge iOS and Surge Dashboard show which server responds first. If Surge has not received any answer in 2 seconds, it queries all servers again. After four retries, Surge gives up and reports a DNS error.
Some domain names may have poorly-performing authoritative name servers, causing upstream DNS servers to return empty answers due to server-side timeout or other connectivity issues. Surge will report an empty DNS error if all upstream DNS servers explicitly return empty DNS answers or if some servers return empty answers and others fail to respond in 2 seconds.
When IPv6 is available and enabled, the Surge DNS client sends both A and AAAA questions to upstream DNS servers. The first A or AAAA answer is used.