Class TNetwork

java.lang.Object
one.tranic.t.network.TNetwork

public class TNetwork extends Object
A utility class for network-related operations, focusing on identifying private IP addresses and NAT-specific ranges.
  • Constructor Details

    • TNetwork

      public TNetwork()
  • Method Details

    • isPrivateIp

      public static boolean isPrivateIp(InetAddress address)
      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

      public static boolean isPrivateIp(String address) throws UnknownHostException
      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

      public static boolean isNatRange(InetAddress address)
      Helper method to detect extended NAT internal ranges.
      Parameters:
      address - the InetAddress to check
      Returns:
      true if part of NAT internal ranges, false otherwise