This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
Swift3: Extension died unexpectedly #31
Comments
It'd be better if you could provide the crash report.
Problem relating to IP packets will not be fixed as of now unless you can locate the bug. It's recommended to not enable TUN interface.
…-------------------
Zhuhao Wang
Zhejiang university
2016年12月4日 +0800 13:21 Cloud <notifications@github.com>,写道:
env
swift: 3.0.1
xcode: 8.1
ios with network extension
First, let me make sure my app and config is correct
In startTunne methodl:
let ipv4Settings = NEIPv4Settings(addresses: ["10.0.0.1"], subnetMasks: ["255.255.255.0"]) let networkSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "8.8.8.8") networkSettings.mtu = 1500 networkSettings.iPv4Settings = ipv4Settings setTunnelNetworkSettings(networkSettings) { error in guard error == nil else { NSLog(error.debugDescription) completionHandler(error) return } completionHandler(nil) }
then start vpn, whatever the app is in the foreground or the background, the VPN is running correct. Network traffic is normal too.
Now, let me use NEKit
In startTunne method:
let directAdapterFactory = DirectAdapterFactory() let allRule = AllRule(adapterFactory: directAdapterFactory) RuleManager.currentManager = RuleManager(fromRules: [allRule], appendDirect: true) RawSocketFactory.TunnelProvider = self self.proxyServer = GCDHTTPProxyServer(address: IPv4Address(fromString: "127.0.0.1"), port: Port(port: UInt16(self.proxyPort))) try! self.proxyServer.start() let networkSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "8.8.8.8") networkSettings.mtu = 1500 let ipv4Settings = NEIPv4Settings(addresses: ["192.169.89.1"], subnetMasks: ["255.255.255.0"]) ipv4Settings.includedRoutes = [NetworkExtension.NEIPv4Route.default()] networkSettings.iPv4Settings = ipv4Settings let proxySettings = NEProxySettings() proxySettings.httpEnabled = true proxySettings.httpServer = NEProxyServer(address: "127.0.0.1", port: proxyPort) proxySettings.httpsEnabled = true proxySettings.httpsServer = NEProxyServer(address: "127.0.0.1", port: proxyPort) proxySettings.excludeSimpleHostnames = true networkSettings.proxySettings = proxySettings let DNSSettings = NEDNSSettings(servers: ["198.18.0.1"]) DNSSettings.matchDomains = [""] DNSSettings.matchDomainsNoSearch = false networkSettings.dnsSettings = DNSSettings setTunnelNetworkSettings(networkSettings) { error in guard error == nil else { DDLogError("Encountered an error setting up the network: \(error)") completionHandler(error) return } self.interface = TUNInterface(packetFlow: self.packetFlow) let fakeIPPool = IPv4Pool(start: IPv4Address(fromString: "198.18.1.1")!, end: IPv4Address(fromString: "198.18.255.255")!) let dnsServer = DNSServer(address: IPv4Address(fromString: "198.18.0.1")!, port: Port(port: 53), fakeIPPool: fakeIPPool) let resolver = UDPDNSResolver(address: IPv4Address(fromString: "114.114.114.114")!, port: Port(port: 53)) dnsServer.registerResolver(resolver) self.interface.registerStack(dnsServer) DNSServer.currentServer = dnsServer let udpStack = UDPDirectStack() self.interface.registerStack(udpStack) let tcpStack = TCPStack.stack tcpStack.proxyServer = self.proxyServer self.interface.registerStack(tcpStack) self.interface.start() completionHandler(nil) }
then start vpn, the vpn can be started, but i found when network traffic was generated, the Network Extension died unexpectedly.
>
> This article (http://blog.w2fzu.com/2016/11/21/2016-11-12-learn-NetworkExtenison/#%E5%9B%9B%E3%80%81%E5%AF%BC%E5%85%A5NEKit) also mentioned this problem.
>
Thanks for your NEKit.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub (#31), or mute the thread (https://github.com/notifications/unsubscribe-auth/ABOmLMeN9V27ijlnnCzwOy22b9oZTSaGks5rEk3OgaJpZM4LDgKW).
|
Thanks |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
env
First, let me make sure my app and config is correct
In startTunne methodl:
then start vpn, whatever the app is in the foreground or the background, the VPN is running correct. Network traffic is normal too.
Now, let me use NEKit
In startTunne method:
then start vpn, the vpn can be started, but i found when network traffic was generated, the Network Extension died unexpectedly.
Thanks for your NEKit.
The text was updated successfully, but these errors were encountered: