Force IPv4 on Mojave otherwise it breaks

This commit is contained in:
Johan Kool 2019-12-18 12:42:56 +01:00
parent e606a261f4
commit 78e332d48b
1 changed files with 9 additions and 0 deletions

View File

@ -46,7 +46,16 @@ public class NETunnelInterface: TunnelInterface {
/// :nodoc: /// :nodoc:
public init(impl: NEPacketTunnelFlow, isIPv6: Bool) { public init(impl: NEPacketTunnelFlow, isIPv6: Bool) {
self.impl = impl self.impl = impl
#if os(macOS)
if #available(OSX 10.15, *) {
protocolNumber = (isIPv6 ? AF_INET6 : AF_INET) as NSNumber
} else {
// Force IPv4 on Mojave otherwise it breaks
protocolNumber = AF_INET as NSNumber
}
#else
protocolNumber = (isIPv6 ? AF_INET6 : AF_INET) as NSNumber protocolNumber = (isIPv6 ? AF_INET6 : AF_INET) as NSNumber
#endif
} }
// MARK: TunnelInterface // MARK: TunnelInterface