Interface NetworkParams

All Known Implementing Classes:
AbstractNetworkParams, LinuxNetworkParams, LinuxNetworkParamsNF, OpenBsdNetworkParams

@PublicApi @ThreadSafe public interface NetworkParams
Provides network parameters of the running operating system, including the hostname, domain name, DNS server addresses, and default gateways for IPv4 and IPv6.

The hostname (getHostName()) is the local machine name. The domain name (getDomainName()) is the DNS domain suffix. DNS servers (getDnsServers()) are the configured name resolution servers. The default gateways (getIpv4DefaultGateway(), getIpv6DefaultGateway()) are the routing destinations for 0.0.0.0/0 and ::/0 respectively, and return an empty string if not defined.

  • Method Details

    • getHostName

      String getHostName()
      Gets the HostName of the machine executing OSHI.
      Returns:
      the hostname
    • getDomainName

      String getDomainName()
      Gets the Domain Name of the machine executing OSHI.
      Returns:
      the domain name
    • getDnsServers

      String[] getDnsServers()
      Gets the DNS Servers configured for this machine.
      Returns:
      the DNS servers
    • getIpv4DefaultGateway

      String getIpv4DefaultGateway()
      Gets the default gateway(routing destination for 0.0.0.0/0) for IPv4 connections.
      Returns:
      default gateway for IPv4, or empty string if not defined.
    • getIpv6DefaultGateway

      String getIpv6DefaultGateway()
      Gets default gateway(routing destination for ::/0) for IPv6 connections.
      Returns:
      default gateway for IPv6, or empty string if not defined.