Class ClientAddressResolver.TrustedProxies

java.lang.Object
com.iizix.server.geo.ip2location.ClientAddressResolver.TrustedProxies
Enclosing class:
ClientAddressResolver

public static final class ClientAddressResolver.TrustedProxies extends Object
The operator's trusted proxies: a set of IP addresses and CIDR prefixes.
Author:
Christopher Mindus
  • Field Details

  • Method Details

    • parse

      public static ClientAddressResolver.TrustedProxies parse(String list)
      Parses a comma- or whitespace-separated list of IP addresses and CIDR prefixes, e.g. "10.0.0.5, 192.168.0.0/16, fd00::/8". An entry that is not an IP literal, or whose prefix length is out of range, is dropped and counted in getRejectedCount(); nothing is resolved through DNS.
      Parameters:
      list - The list, null or blank for none.
      Returns:
      The trusted proxies, NONE for an empty list.
    • isEmpty

      public boolean isEmpty()
      Returns if no proxy is trusted.
      Returns:
      true when the set is empty.
    • size

      public int size()
      Gets the number of configured entries.
      Returns:
      The count of accepted entries.
    • getRejectedCount

      public int getRejectedCount()
      Gets the number of entries that were dropped by parse(String).
      Returns:
      The count of rejected entries.
    • contains

      public boolean contains(InetAddress address)
      Checks if an address is a trusted proxy.
      Parameters:
      address - The address, null is never trusted.
      Returns:
      true when the address matches an entry.