Class IpSet

    • Field Detail

      • SERIALIZER

        public static final org.spongepowered.configurate.serialize.TypeSerializer<IpSet> SERIALIZER
    • Method Detail

      • only

        public static IpSet only​(InetAddress address)
        Create an IP set matching only one single address.
        Parameters:
        address - the address to match
        Returns:
        a new ip set
      • fromAddrPrefix

        public static IpSet fromAddrPrefix​(InetAddress address,
                                           int prefixLen)
        Resolve an ip set from address and prefix length
        Parameters:
        address - the IP address
        prefixLen - the prefix length
        Returns:
        a new ip set
        Throws:
        IllegalArgumentException - if the prefix length is not valid for the provided address
      • fromCidr

        public static IpSet fromCidr​(String spec)
        Given a CIDR range, construct an IP set.
        Parameters:
        spec - the specification
        Returns:
        a parsed ip set matching the range
        Throws:
        IllegalArgumentException - if the syntax is not valid for CIDR, or the prefix length is invalid.
      • toString

        public String toString()
        Get the CIDR string representation of this IP set.
        Overrides:
        toString in class Object
        Returns:
        the representation