Package one.tranic.t.network
Class TNetwork
java.lang.Object
one.tranic.t.network.TNetwork
A utility class for network-related operations, focusing on
identifying private IP addresses and NAT-specific ranges.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisNatRange(InetAddress address) Helper method to detect extended NAT internal ranges.static booleanisPrivateIp(String address) Checks if a given IP address in String format is a private IP address.static booleanisPrivateIp(InetAddress address) Checks if an InetAddress is a private IP address.
-
Constructor Details
-
TNetwork
public TNetwork()
-
-
Method Details
-
isPrivateIp
Checks if an InetAddress is a private IP address.- Parameters:
address- the InetAddress to check- Returns:
- true if the address is a private IP, false otherwise
-
isPrivateIp
Checks if a given IP address in String format is a private IP address.- Parameters:
address- the IP address as a String to check- Returns:
- true if the address is a private IP, false otherwise
- Throws:
UnknownHostException- if the string cannot be parsed as an IP address
-
isNatRange
Helper method to detect extended NAT internal ranges.- Parameters:
address- the InetAddress to check- Returns:
- true if part of NAT internal ranges, false otherwise
-