pull/590/head
FongMi 8 months ago
parent 4c2d2b90a5
commit 1e542f4bde
  1. 3
      catvod/src/main/java/com/github/catvod/utils/Util.java

@ -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) {

Loading…
Cancel
Save