In xcode select File -> New -> Target
Choose System Network Extension, select PacketTunnelProvider.
Now I get this stub code, but don't know what to do next. I need a minimal working example.
@implementation PacketTunnelProvider
- (void)startTunnelWithOptions:(NSDictionary *)options completionHandler:(void (^)(NSError *))completionHandler {
// maybe process the packet from there? a tcp level read / write method call?
}
- (void)stopTunnelWithReason:(NEProviderStopReason)reason completionHandler: (void (^)(void))completionHandler {
// Add code here to start the process of stopping the tunnel.
completionHandler();
}
- (void)handleAppMessage:(NSData *)messageData completionHandler:(void (^)(NSData *))completionHandler {
// Add code here to handle the message.
}
- (void)sleepWithCompletionHandler:(void (^)(void))completionHandler {
// Add code here to get ready to sleep.
completionHandler();
}
- (void)wake {
// Add code here to wake up.
}
@end
Topic:
App & System Services
SubTopic:
Networking
Tags: