Skip to content

okhttp / okhttp3 / HttpUrl / topPrivateDomain


fun topPrivateDomain():String?

Returns the domain name of this URL’s host that is one level beneath the public suffix by consulting the public suffix list. Returns null if this URL’s host is an IP address or is considered a public suffix by the public suffix list.

In general this method should not be used to test whether a domain is valid or routable. Instead, DNS is the recommended source for that information.

URL topPrivateDomain() "" ""
http://square null null
http://localhost null null