@@ -44,19 +44,19 @@ class Networking {
44
44
interfaceAddress. sa_family == UInt8 ( AF_INET) {
45
45
// Check if interface is en0 which is the WiFi connection on the iPhone
46
46
let name = String ( cString: interfacePointer. pointee. ifa_name)
47
- if name == " en0 " {
48
47
// Convert interface address to a human readable string:
49
- var hostname = [ CChar] ( repeating: 0 , count: Int ( NI_MAXHOST) )
50
- if getnameinfo (
51
- interfacePointer. pointee. ifa_addr,
52
- socklen_t ( interfaceAddress. sa_len) ,
53
- & hostname,
54
- socklen_t ( hostname. count) ,
55
- nil ,
56
- socklen_t ( 0 ) ,
57
- NI_NUMERICHOST
58
- ) == 0 {
59
- ipAddress = String ( cString: hostname)
48
+ var hostname = [ CChar] ( repeating: 0 , count: Int ( NI_MAXHOST) )
49
+ if getnameinfo (
50
+ interfacePointer. pointee. ifa_addr,
51
+ socklen_t ( interfaceAddress. sa_len) ,
52
+ & hostname,
53
+ socklen_t ( hostname. count) ,
54
+ nil ,
55
+ socklen_t ( 0 ) ,
56
+ NI_NUMERICHOST
57
+ ) == 0 {
58
+ ipAddress = String ( cString: hostname)
59
+ if ipAddress. starts ( with: " 192.168 " ) {
60
60
return ipAddress
61
61
}
62
62
}
@@ -65,7 +65,7 @@ class Networking {
65
65
66
66
freeifaddrs ( interfaceList)
67
67
68
- throw NetworkingError . internalError ( reason: " Failed to determine device's IP address " )
68
+ throw NetworkingError . internalError ( reason: " No local IP found " )
69
69
}
70
70
71
71
/// Get configured ad serving domain
0 commit comments