iOS implementing NETunnelProviderProtocol with no remote server

前端 未结 2 1111
孤独总比滥情好
孤独总比滥情好 2021-01-15 15:10

I\'m trying to implement a packet sniffer similar to Charles for iOS using iOS\'s NetworkExtension framework.

Objective

So, that\'s a big goal and I\'m bre

相关标签:
2条回答
  • 2021-01-15 15:39

    There are a good number of reasons why your network extension process may not be starting:

    1. I would put a breakpoint on the os_log("STARTING TUNNEL!!!!") and attach to your network extension process in Xcode via Debug -> Attach to Process by PID or Name... before you attempt to start the VPN
    2. The network extension must extend the bundle id of the containing app. E.g. if the containing app is com.example.vpn then the network extension might be com.example.vpn.tunnel.
    3. Ensure that your Network Extension Info.plist contains the NSExtension dictionary with NSExtensionPointIdentifier and NSExtensionPrincipalClass containing com.apple.networkextension.packet-tunnel and your NEPacketTunnelProvider class (e.g. $(PRODUCT_MODULE_NAME).PacketTunnelProvider) respectively.
    4. Is the Packet Tunnel Provider Network Extension entitlement applied to both the containing application and the network extension?
    5. If you are implementing a Packet Tunnel Provider, you do not want to enable the Personal VPN entitlement.
    0 讨论(0)
  • 2021-01-15 15:42

    in startVPNTunnel func ,you should call setTunnelNetworkSettings,then the tunnel will started, after that ,you can read/write packet.

    setTunnelNetworkSettings(nil) {  error in
                pendingStartCompletion(error)
                
     }

    0 讨论(0)
提交回复
热议问题