Define OpenVPNAdapterPacketFlow and use it instead of NEPacketTunnelFlow object to simplify testing

This commit is contained in:
Sergey Abramchuk
2017-03-09 19:08:24 +03:00
parent 3c840cd0f8
commit 1e886eaca7
4 changed files with 24 additions and 7 deletions
+7 -3
View File
@@ -10,14 +10,19 @@
#import "OpenVPNAdapter.h"
@class NEPacketTunnelFlow;
@class NEPacketTunnelNetworkSettings;
@protocol OpenVPNAdapterPacketFlow <NSObject>
- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols))completionHandler;
- (BOOL)writePackets:(nonnull NSArray<NSData *> *)packets withProtocols:(nonnull NSArray<NSNumber *> *)protocols;
@end
@protocol OpenVPNAdapterDelegate <NSObject>
- (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings
callback:(nonnull void (^)(NEPacketTunnelFlow * __nullable flow))callback
callback:(nonnull void (^)(id<OpenVPNAdapterPacketFlow> _Nullable flow))callback
NS_SWIFT_NAME(configureTunnel(settings:callback:));
- (void)handleEvent:(OpenVPNEvent)event
@@ -29,7 +34,6 @@ NS_SWIFT_NAME(handle(error:));
@end
@interface OpenVPNAdapter (Provider)
@property (strong, nonatomic, nullable) NSString *username;