OpenVPNAdapter調用出現問題:TUN Error: cannot acquire tun interface socket
阿新 • • 發佈:2018-11-09
OpenVPNAdapter的呼叫
在除錯ios版openvpn的時候,在控制檯看到的出現的問題,連線失敗:
TUN Error: cannot acquire tun interface socket
參考:https://github.com/ss-abramchuk/OpenVPNAdapter/issues/37
原因:沒有讓packet通過,沒有設定setTunnelNetworkSettings
解決方法:修改或新增demo中extension PacketTunnelProvider: OpenVPNAdapterDelegate
的方法:
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings, completionHandler: @escaping (OpenVPNAdapterPacketFlow?) -> Void) { setTunnelNetworkSettings(networkSettings) { (error) in completionHandler(error == nil ? self.packetFlow : nil) } }