Enum Class IPMode

java.lang.Object
java.lang.Enum<IPMode>
com.iizix.server.geo.ip2location.IPMode
All Implemented Interfaces:
Serializable, Comparable<IPMode>, Constable

public enum IPMode extends Enum<IPMode>
The IP address mode of the IP2Location service: IPv4 only, or IPv4 and IPv6. Ported from the NetPhantom administration panel (co.mindus.ip2location.ui.IPMode), where the two radio buttons of the IP2Location page choose between them; the setting behind it is the boolean ServerSettings.IP2LOCATION_IPV6.

IPv4 and IPv6 downloads and loads both database files, which roughly doubles the disk and memory the service takes; IPv4 only answers IPv6 lookups with "not supported" (6to4 and Teredo addresses still resolve through their embedded IPv4 address).

Author:
Christopher Mindus
  • Enum Constant Details

    • IPV4_ONLY

      public static final IPMode IPV4_ONLY
      IPv4 addresses only: one database file.
    • IPV4_AND_IPV6

      public static final IPMode IPV4_AND_IPV6
      IPv4 and IPv6 addresses: two database files.
  • Method Details

    • values

      public static IPMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static IPMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • includesIPv6

      public boolean includesIPv6()
      Checks if this mode includes IPv6.
      Returns:
      true for IPV4_AND_IPV6, false for IPV4_ONLY.
    • fromIncludeIPv6

      public static IPMode fromIncludeIPv6(boolean includeIPv6)
      Gets the mode of the IPv6 flag.
      Parameters:
      includeIPv6 - The flag, as ServerSettings.isIP2LocationIPv6Enabled() answers it.
      Returns:
      IPV4_AND_IPV6 for true, IPV4_ONLY for false.
    • fromName

      public static IPMode fromName(String name)
      Gets the mode of a name, leniently.
      Parameters:
      name - The enum name, or null.
      Returns:
      The mode, IPV4_ONLY for null, an empty or an unknown name.