pub fn detect_domain() -> Option<String>Expand description
Returns the configured DNS domain name.
On Linux, the domain of the link carrying the IP default route wins (see
resolve_default_route_domain). /etc/resolv.conf is only a fallback there, because
under systemd-resolved it is the stub file whose search list is the merged set of
every link’s domains — so its first entry is frequently a VPN’s domain rather than the
default route’s. On macOS, /etc/resolv.conf is written by configd from the primary
network service, so it is read directly. On Windows, queries the primary DNS domain
via GetComputerNameExW (ComputerNameDnsDomain).
Returns None when no domain is configured (e.g. a workgroup machine, or a default-route
link with no DNS domain of its own) or the source is unavailable.