dnsDomainLevels()

Number of dots in the host name ("www.corp.example" gives 2).

dnsDomainLevels(host)  →  number

Counts dots, so it also counts them in IP literals: dnsDomainLevels("10.1.2.3") is 3.

Example

if (dnsDomainLevels(host) == 0) {
  return "DIRECT";
}

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
dnsDomainLevelsyesyesyesyesyesyesyes

Related rules