java.lang.Object
net.i2p.apache.http.conn.util.PublicSuffixMatcher

public final class PublicSuffixMatcherextends Object
Utility class that can test if DNS names match the content of the Public Suffix List.

An up-to-date list of suffixes can be obtained from publicsuffix.org.

See Also:
  • Field Details

  • Constructor Details

    • PublicSuffixMatcher

      public PublicSuffixMatcher(Collection<String> rules, Collection<String> exceptions)
      Create public suffix matcher.
      Parameters:
      rules - domain suffix rules
      exceptions - domain suffix exceptions
  • Method Details

    • getDomainRoot

      public String getDomainRoot(String domain)
      Returns registrable part of the domain for the given domain name of null if given domain represents a public suffix.
      Parameters:
      domain - the domain name to check
      Returns:
      the registrable part of the domain, or null if the name is a public suffix, is null, or starts with a dot
    • matches

      public boolean matches(String domain)
      Test if the given domain is a public suffix, meaning it has no registrable part.
      Parameters:
      domain - the domain name to check, a leading dot is ignored
      Returns:
      true if the domain is a public suffix, or is null