Class CastLink.Interface

java.lang.Object
com.iizigo.panel.CastLink.Interface
Enclosing class:
CastLink

public static final class CastLink.Interface extends Object
A network interface as the address filter reads it: what the system says about it, and its addresses. A test builds these directly; CastLink.enumerate() builds them from the system.
Author:
Christopher Mindus
  • Constructor Details

    • Interface

      public Interface(String name, String label, String kind, boolean up, boolean loopback, boolean pointToPoint, boolean hasHardwareAddress, boolean virtualMachine, List<InetAddress> addresses)
      Creates an interface.
      Parameters:
      name - The system name, e.g. "eth0".
      label - The name a user knows it by, e.g. "Wi-Fi"; null or empty for the system name.
      kind - The kind, "Wi-Fi" or "Ethernet", null when not known.
      up - The interface is up.
      loopback - The interface is a loopback interface.
      pointToPoint - The interface is a point-to-point interface.
      hasHardwareAddress - The interface has a hardware (MAC) address.
      virtualMachine - The hardware address belongs to a virtual machine vendor.
      addresses - The addresses.
    • Interface

      public Interface(String name, String label, String kind, boolean up, boolean loopback, boolean pointToPoint, boolean hasHardwareAddress, boolean virtualMachine, boolean defaultRoute, List<InetAddress> addresses)
      Creates an interface.
      Parameters:
      name - The system name, e.g. "eth0".
      label - The name a user knows it by, e.g. "Wi-Fi"; null or empty for the system name.
      kind - The kind, "Wi-Fi" or "Ethernet", null when not known.
      up - The interface is up.
      loopback - The interface is a loopback interface.
      pointToPoint - The interface is a point-to-point interface.
      hasHardwareAddress - The interface has a hardware (MAC) address.
      virtualMachine - The hardware address belongs to a virtual machine vendor.
      defaultRoute - The interface carries the default route (IPv4 or IPv6).
      addresses - The addresses.
  • Method Details

    • getName

      public String getName()
      Gets the system name.
      Returns:
      The name.
    • getDisplayName

      public String getDisplayName()
      Gets the name shown in the chooser: the name a user knows the interface by, followed by its kind in parentheses when the name does not already say it, e.g. "Ethernet - 1 GBE", "en0", "Intel(R) Wi-Fi 6E AX210 (Wi-Fi)".
      Returns:
      The text.
    • getAddresses

      public List<InetAddress> getAddresses()
      Gets the addresses.
      Returns:
      The unmodifiable list.
    • isDefaultRoute

      public boolean isDefaultRoute()
      Tells whether the interface carries the default route (IPv4 or IPv6).
      Returns:
      true when this computer sends from one of its addresses on a default route.
    • isOffered

      public boolean isOffered()
      Tells whether the filter offers this interface's addresses at all.
      Returns:
      true for an interface a phone may reach: up, not a loopback, not point-to-point, with a hardware address that is not a virtual machine vendor's - or is one, on the interface of the default route.
    • toString

      public String toString()
      Debug string.
      Overrides:
      toString in class Object