Class NetworkUtils

java.lang.Object
org.elasticsearch.common.network.NetworkUtils

public abstract class NetworkUtils extends Object
Utilities for network interfaces / addresses binding and publishing. Its only intended for that purpose, not general purpose usage!!!!
  • Field Details

    • SUPPORTS_V6

      @Deprecated public static final boolean SUPPORTS_V6
      Deprecated.
      transition mechanism only, do not use
      True if we can bind to a v6 address. Its silly, but for *binding* we have a need to know if the stack works. this can prevent scary noise on IPv4-only hosts.
  • Method Details

    • sortAddresses

      @Deprecated public static void sortAddresses(List<InetAddress> list)
      Deprecated.
      remove this when multihoming is really correct
      Sorts addresses by order of preference. This is used to pick the first one for publishing
    • defaultReuseAddress

      public static boolean defaultReuseAddress()
      Returns system default for SO_REUSEADDR
    • getAllAddresses

      public static InetAddress[] getAllAddresses() throws IOException
      Returns all addresses (any scope) for interfaces that are up. This is only used to pick a publish address, when the user set network.host to a wildcard
      Throws:
      IOException
    • getAllIPV4Addresses

      public static InetAddress[] getAllIPV4Addresses() throws IOException
      Returns:
      all IPv4 addresses for interfaces that are up.
      Throws:
      IOException
    • getAllIPV6Addresses

      public static InetAddress[] getAllIPV6Addresses() throws IOException
      Returns:
      all IPv6 addresses for interfaces that are up.
      Throws:
      IOException