mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
#129 list IPv4 addresses first, and then IPv6
This commit is contained in:
parent
1615922f17
commit
3cadd94bb5
@ -10,9 +10,11 @@ import org.eclipse.swt.events.TraverseListener;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.Comparator.comparing;
|
||||
import static net.azib.ipscan.util.InetAddressUtils.getNetworkInterfaces;
|
||||
|
||||
/**
|
||||
@ -84,7 +86,9 @@ public class FeederActions {
|
||||
};
|
||||
|
||||
for (NetworkInterface networkInterface : getNetworkInterfaces()) {
|
||||
for (InterfaceAddress ifaddr : networkInterface.getInterfaceAddresses()) {
|
||||
List<InterfaceAddress> addresses = networkInterface.getInterfaceAddresses();
|
||||
addresses.sort(comparing(i -> i.getAddress().getAddress().length));
|
||||
for (InterfaceAddress ifaddr : addresses) {
|
||||
if (ifaddr == null) continue;
|
||||
InetAddress address = ifaddr.getAddress();
|
||||
if (!address.isLoopbackAddress()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user