Class NetworkInterfaceWrapper

java.lang.Object
org.eblocker.server.common.network.NetworkInterfaceWrapper

public class NetworkInterfaceWrapper extends Object
Network utilities
  • Constructor Details

  • Method Details

    • init

      public void init()
    • getFirstIPv4Address

      public Ip4Address getFirstIPv4Address()
      Returns the primary IPv4 IP address
    • notifyIPAddressChanged

      public void notifyIPAddressChanged(Ip4Address newIP)
      This method actually updates the current IPv4 address from the network interface; Call this method, if e.g. the device got a new IPv4 address via DHCP in automatic mode.
    • notifyIp6AddressChanged

      public void notifyIp6AddressChanged()
      Once a NetworkInterface object has been created its IP addresses do not change. Therefore, an external process must detect IPv6 address updates and call this method to reload the NetworkInterface.
    • getIp6LinkLocalAddress

      public Ip6Address getIp6LinkLocalAddress()
    • getAddresses

      public List<IpAddress> getAddresses()
    • hasGlobalIp6Address

      public boolean hasGlobalIp6Address()
    • getNetworkPrefixLength

      public int getNetworkPrefixLength(IpAddress ipAddress)
      Returns the network prefix length (in bits) of the given IP address
      Parameters:
      ipAddress - IP address
      Returns:
      -1 if there was no networkInterface
    • getHardwareAddress

      public byte[] getHardwareAddress()
    • getHardwareAddressHex

      public String getHardwareAddressHex()
    • getInterfaceName

      public String getInterfaceName()
    • findGatewayAndWriteToRedis

      public void findGatewayAndWriteToRedis()
      Look for a gateway, and if found write it to Redis (script)
    • isUp

      public boolean isUp()
    • getVpnIpv4Address

      public Ip4Address getVpnIpv4Address()
    • getMtu

      public int getMtu()
    • addIpAddressChangeListener

      public void addIpAddressChangeListener(NetworkInterfaceWrapper.IpAddressChangeListener listener)