Ignore utunX interfaces when detecting public IP

This commit is contained in:
Andrius Dagys 2017-04-20 15:14:46 +01:00 committed by Mike Hearn
parent 08e7eb1a57
commit a01c466beb

View File

@ -7,6 +7,7 @@ object AddressUtils {
/** Returns the first public IP address found on any of the network interfaces, or `null` if none found. */
fun tryDetectPublicIP(): InetAddress? {
for (int in NetworkInterface.getNetworkInterfaces()) {
if (int.name.startsWith("utun")) continue
for (address in int.inetAddresses) {
if (isPublic(address)) return address
}