in hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java [77:99]
public List<InetAddress> getLocalAllInetAddress() {
Enumeration<NetworkInterface> interfaces;
try {
interfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new RuntimeException("Failed to get network interfaces");
}
List<InetAddress> result = new ArrayList<>();
while (interfaces.hasMoreElements()) {
NetworkInterface nw = interfaces.nextElement();
for (Enumeration<InetAddress> inetAddresses = nw.getInetAddresses();
inetAddresses.hasMoreElements(); ) {
InetAddress inetAddr = inetAddresses.nextElement();
if (!inetAddr.isLoopbackAddress() &&
!inetAddr.isLinkLocalAddress() &&
!inetAddr.isMulticastAddress()) {
result.add(inetAddr);
}
}
}
return result;
}