Enum IPVersionFilter
- java.lang.Object
-
- java.lang.Enum<IPVersionFilter>
-
- com.amazonaws.kinesisvideo.client.IPVersionFilter
-
- All Implemented Interfaces:
Serializable,Comparable<IPVersionFilter>
@ThreadSafe public enum IPVersionFilter extends Enum<IPVersionFilter>
An enumeration that defines IP version filtering options for network connections. This filter can be used to restrict network connections to specific IP protocol versions.The filter supports three modes:
IPV4_AND_IPV6- Allows both IPv4 and IPv6 addressesIPV4- Allows only IPv4 addressesIPV6- Allows only IPv6 addresses
Example usage:
IPVersionFilter filter = IPVersionFilter.IPV4; InetAddress address = InetAddress.getByName("192.168.1.1"); if (filter.matches(address)) { // Address is allowed by the filter }
-
-
Enum Constant Summary
Enum Constants Enum Constant Description IPV4Allows only IPv4 addresses.IPV4_AND_IPV6Allows both IPv4 and IPv6 addresses.IPV6Allows only IPv6 addresses.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanmatches(InetAddress address)Determines whether the given InetAddress matches this IP version filter.static IPVersionFiltervalueOf(String name)Returns the enum constant of this type with the specified name.static IPVersionFilter[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
IPV4_AND_IPV6
public static final IPVersionFilter IPV4_AND_IPV6
Allows both IPv4 and IPv6 addresses. This is the most permissive filter option.
-
IPV4
public static final IPVersionFilter IPV4
Allows only IPv4 addresses. IPv6 addresses will be rejected by this filter.
-
IPV6
public static final IPVersionFilter IPV6
Allows only IPv6 addresses. IPv4 addresses will be rejected by this filter.
-
-
Method Detail
-
values
public static IPVersionFilter[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (IPVersionFilter c : IPVersionFilter.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static IPVersionFilter valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
matches
public boolean matches(@Nullable InetAddress address)
Determines whether the given InetAddress matches this IP version filter.The matching logic is as follows:
- For
IPV4: Returnstrueonly if the address is an instance ofInet4Address - For
IPV6: Returnstrueonly if the address is an instance ofInet6Address - For
IPV4_AND_IPV6: Returnstrueif the address is either IPv4 or IPv6
- Parameters:
address- the InetAddress to check against this filter.- Returns:
trueif the address matches this filter's criteria,falseotherwise (nullwill befalse).- See Also:
Inet4Address,Inet6Address
- For
-
-