dnsResolve()
Resolves a host name to an IP address string, or null. Performs a blocking DNS lookup.
dnsResolve(host) → string or nullComparing 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
| Engine | Behaviour | Source |
|---|---|---|
| chromium | IPv4 only. | code, verified 2026-10-04 |
| pacparser | IPv4 only (getaddrinfo with AF_INET), real system DNS. | code, verified 2026-10-04 |
| firefox | May return IPv6 addresses as well. | expert, unverified |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | pacparser | reference |
|---|---|---|---|---|---|---|---|
dnsResolve | yes | yes | yes | yes | yes | yes | yes |