Class MacAddressUtil
java.lang.Object
io.netty.util.internal.MacAddressUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Obtains the best MAC address found on local network interfaces.static byte[]Returns the result ofbestAvailableMac()if non-nullotherwise returns a random EUI-64 MAC address.static StringformatAddress(byte[] addr) static byte[]Parse a EUI-48, MAC-48, or EUI-64 MAC address from aStringand return it as abyte[].
-
Method Details
-
bestAvailableMac
public static byte[] bestAvailableMac()Obtains the best MAC address found on local network interfaces. Generally speaking, an active network interface used on public networks is better than a local network interface.- Returns:
- byte array containing a MAC. null if no MAC can be found.
-
defaultMachineId
public static byte[] defaultMachineId()Returns the result ofbestAvailableMac()if non-nullotherwise returns a random EUI-64 MAC address. -
parseMAC
-
formatAddress
- Parameters:
addr- byte array of a MAC address.- Returns:
- hex formatted MAC address.
-