dnsResolve()

Resolves a host name to an IP address string, or null. Performs a blocking DNS lookup.

dnsResolve(host)  →  string or null

Comparing its result with a literal (dnsResolve(host) == "10.1.2.3") breaks as soon as the record changes or resolves differently inside and outside the network. Use isInNet on a range instead, and call it at most once per evaluation.

Example

var ip = dnsResolve(host);
if (ip && isInNet(ip, "10.0.0.0", "255.0.0.0")) {
  return "DIRECT";
}

Engine notes

EngineBehaviourSource
chromiumIPv4 only.code, verified 2026-10-04
services/proxy_resolver/proxy_resolver_v8.cc (binding table)
pacparserIPv4 only (getaddrinfo with AF_INET), real system DNS.code, verified 2026-10-04
src/pacparser.c@v1.5.3 dns_resolve()
firefoxMay return IPv6 addresses as well.expert, unverified

Availability

Derived from each engine's vendored helper library plus its native bindings (see engines).
Functionchromium
<=51
chromium
>=52
firefox
all
pacparser
<=1.4.6
pacparser
1.5.0
pacparser
>=1.5.1
reference
all
dnsResolveyesyesyesyesyesyesyes

Related rules