protected void logInterfaceInformation(NetworkInterface networkInterface) throws SocketException { log.info("---------------------------------------------------------------------------------"); log.info(String.format("Interface display name: %s", networkInterface.getDisplayName())); if (networkInterface.getParent() != null) log.info(String.format("Parent Info: %s", networkInterface.getParent())); log.info(String.format("Name: %s", networkInterface.getName()));
protected void logInterfaceInformation(NetworkInterface networkInterface) throws SocketException { log.info("---------------------------------------------------------------------------------"); log.info(String.format("Interface display name: %s", networkInterface.getDisplayName())); if (networkInterface.getParent() != null) log.info(String.format("Parent Info: %s", networkInterface.getParent())); log.info(String.format("Name: %s", networkInterface.getName()));
@Nonnull public static IParentProvider <NetworkInterface> parentProvider () { return aObj -> aObj.getParent (); } }
@Nonnull public static IParentProvider <NetworkInterface> parentProvider () { return aObj -> aObj.getParent (); } }
static Map<NetworkInterface, Set<InetAddress>> pruneAliasDuplicates(Map<NetworkInterface, Set<InetAddress>> result) { final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>(); for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) { NetworkInterface ni = entry.getKey(); if (ni.getParent() != null) { pruned.put(ni, entry.getValue()); } else { Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue()); Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces(); while (subInterfaces.hasMoreElements()) { NetworkInterface sub = subInterfaces.nextElement(); Set<InetAddress> subAddresses = result.get(sub); if (subAddresses != null) { retained.removeAll(subAddresses); } } if (retained.size() > 0) { pruned.put(ni, retained); } } } return pruned; }
static Map<NetworkInterface, Set<InetAddress>> pruneAliasDuplicates(Map<NetworkInterface, Set<InetAddress>> result) { final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>(); for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) { NetworkInterface ni = entry.getKey(); if (ni.getParent() != null) { pruned.put(ni, entry.getValue()); } else { Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue()); Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces(); while (subInterfaces.hasMoreElements()) { NetworkInterface sub = subInterfaces.nextElement(); Set<InetAddress> subAddresses = result.get(sub); if (subAddresses != null) { retained.removeAll(subAddresses); } } if (retained.size() > 0) { pruned.put(ni, retained); } } } return pruned; }
static Map<NetworkInterface, Set<InetAddress>> pruneAliasDuplicates(Map<NetworkInterface, Set<InetAddress>> result) { final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>(); for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) { NetworkInterface ni = entry.getKey(); if (ni.getParent() != null) { pruned.put(ni, entry.getValue()); } else { Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue()); Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces(); while (subInterfaces.hasMoreElements()) { NetworkInterface sub = subInterfaces.nextElement(); Set<InetAddress> subAddresses = result.get(sub); if (subAddresses != null) { retained.removeAll(subAddresses); } } if (retained.size() > 0) { pruned.put(ni, retained); } } } return pruned; }
static Map<NetworkInterface, Set<InetAddress>> pruneAliasDuplicates(Map<NetworkInterface, Set<InetAddress>> result) { final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>(); for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) { NetworkInterface ni = entry.getKey(); if (ni.getParent() != null) { pruned.put(ni, entry.getValue()); } else { Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue()); Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces(); while (subInterfaces.hasMoreElements()) { NetworkInterface sub = subInterfaces.nextElement(); Set<InetAddress> subAddresses = result.get(sub); if (subAddresses != null) { retained.removeAll(subAddresses); } } if (retained.size() > 0) { pruned.put(ni, retained); } } } return pruned; }
&& !networkInterface.isPointToPoint() && !networkInterface.isVirtual() && networkInterface.getParent() == null && (mac = networkInterface.getHardwareAddress()) != null && mac.length >= 6) {
protected void logInterfaceInformation(NetworkInterface networkInterface) throws SocketException { log.info("---------------------------------------------------------------------------------"); log.info(String.format("Interface display name: %s", networkInterface.getDisplayName())); if (networkInterface.getParent() != null) log.info(String.format("Parent Info: %s", networkInterface.getParent())); log.info(String.format("Name: %s", networkInterface.getName()));
console.printf("Parent: %s%n", netint.getParent()); try
public static NetworkInterface copyOf(java.net.NetworkInterface mutable) throws IOException { Builder builder = builder(); if (mutable.getParent() != null) { builder.withParent(Optional.of(copyOf(mutable.getParent()))); } builder.withName(mutable.getName()); builder.withAddresses(InetAddress.copyOf(list(mutable.getInetAddresses()))); builder.withDisplayName(mutable.getDisplayName()); builder.withIndex(fromNegativeToAbsent(mutable.getIndex())); builder.withMtu(mutable.getMTU()); builder.withLoopback(mutable.isLoopback()); builder.withPointToPoint(mutable.isPointToPoint()); builder.withUp(mutable.isUp()); builder.withVirtual(mutable.isVirtual()); builder.withSupportsMulticast(mutable.supportsMulticast()); builder.withHardwareAddress(getHardwareAddress(mutable.getHardwareAddress())); builder.withSubInterfaces(copyOf(list(mutable.getSubInterfaces()))); return builder.build(); }