|
|
|
|
@ -129,7 +129,8 @@ public class Util { |
|
|
|
|
private static String getHostAddress() throws SocketException { |
|
|
|
|
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) { |
|
|
|
|
NetworkInterface nif = en.nextElement(); |
|
|
|
|
if (nif.getHardwareAddress() == null || !nif.getName().startsWith("eth")) continue; |
|
|
|
|
String name = nif.getName(); |
|
|
|
|
if (name.startsWith("veth") || name.startsWith("tun") || name.startsWith("tap") || nif.getHardwareAddress() == null) continue; |
|
|
|
|
for (Enumeration<InetAddress> addresses = nif.getInetAddresses(); addresses.hasMoreElements(); ) { |
|
|
|
|
InetAddress inetAddress = addresses.nextElement(); |
|
|
|
|
if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) { |
|
|
|
|
|