Hi
I want to use packet tunnel provider for manage traffic usage on ios device, and I do not want to connect to a remote vpn server ( I mean the address target is 127.0.0.1 or localhost). I want to use it for adblocking purpose on all traffic data in all applications
So here is my question, how can I config the tunnel provider protocol for run in localhost:
here is my configuration:
and the loadConfig() function is:
and also I used { NEVPNManager.shared() }() for defining vpnManager
I want to use packet tunnel provider for manage traffic usage on ios device, and I do not want to connect to a remote vpn server ( I mean the address target is 127.0.0.1 or localhost). I want to use it for adblocking purpose on all traffic data in all applications
So here is my question, how can I config the tunnel provider protocol for run in localhost:
here is my configuration:
Code Block let providerProtocol = NETunnelProviderProtocol() providerProtocol.providerBundleIdentifier = "com.project.tunnel" providerProtocol.serverAddress = "127.0.0.1" //???? providerProtocol.username = "uid" vpnManager.localizedDescription = "local" vpnManager.protocolConfiguration = providerProtocol vpnManager.isEnabled = true self.vpnManager.saveToPreferences { (err) in self.loadConfig() }
and the loadConfig() function is:
Code Block func loadConfig() { vpnManager.loadFromPreferences { (err) in if let err = err { print(">>error is :\(err.localizedDescription)") } do { try self.vpnManager.connection.startVPNTunnel() } catch { print(">> error when connect is \(error.localizedDescription)") } } }
and also I used { NEVPNManager.shared() }() for defining vpnManager