mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2024-10-06 17:22:07 +08:00
Update name of configuration method and add templates for documentation
This commit is contained in:
parent
a953a8ab24
commit
e423ade642
@ -14,43 +14,111 @@
|
||||
|
||||
// TODO: Add documentation to properties and methods
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@protocol OpenVPNAdapterPacketFlow <NSObject>
|
||||
|
||||
- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols))completionHandler;
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param completionHandler <#completionHandler description#>
|
||||
*/
|
||||
- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols))completionHandler;
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param packets <#packets description#>
|
||||
@param protocols <#protocols description#>
|
||||
@return <#return value description#>
|
||||
*/
|
||||
- (BOOL)writePackets:(nonnull NSArray<NSData *> *)packets withProtocols:(nonnull NSArray<NSNumber *> *)protocols;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@protocol OpenVPNAdapterDelegate <NSObject>
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param settings <#settings description#>
|
||||
@param callback <#callback description#>
|
||||
*/
|
||||
- (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings
|
||||
callback:(nonnull void (^)(id<OpenVPNAdapterPacketFlow> _Nullable flow))callback
|
||||
NS_SWIFT_NAME(configureTunnel(settings:callback:));
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param event <#event description#>
|
||||
@param message <#message description#>
|
||||
*/
|
||||
- (void)handleEvent:(OpenVPNEvent)event
|
||||
message:(nullable NSString *)message
|
||||
NS_SWIFT_NAME(handle(event:message:));
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param error <#error description#>
|
||||
*/
|
||||
- (void)handleError:(nonnull NSError *)error
|
||||
NS_SWIFT_NAME(handle(error:));
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param logMessage <#logMessage description#>
|
||||
*/
|
||||
- (void)handleLog:(nonnull NSString *)logMessage
|
||||
NS_SWIFT_NAME(handle(logMessage:));
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@interface OpenVPNAdapter (Provider)
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@property (strong, nonatomic, nullable) NSString *username;
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@property (strong, nonatomic, nullable) NSString *password;
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
*/
|
||||
@property (weak, nonatomic, null_unspecified) id<OpenVPNAdapterDelegate> delegate;
|
||||
|
||||
- (BOOL)configureUsing:(nonnull NSData *)settings
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
@param settings <#settings description#>
|
||||
@param error <#error description#>
|
||||
@return <#return value description#>
|
||||
*/
|
||||
- (BOOL)configureUsingSettings:(nonnull NSData *)settings
|
||||
error:(out NSError * __nullable * __nullable)error
|
||||
NS_SWIFT_NAME(configure(using:));
|
||||
|
||||
/**
|
||||
Establish connection with the VPN server
|
||||
*/
|
||||
- (void)connect;
|
||||
|
||||
/**
|
||||
Close connection with the VPN server
|
||||
*/
|
||||
- (void)disconnect;
|
||||
|
||||
@end
|
||||
|
@ -393,7 +393,7 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
|
||||
|
||||
#pragma mark Client Configuration
|
||||
|
||||
- (BOOL)configureUsing:(NSData *)settings error:(out NSError * __autoreleasing _Nullable *)error {
|
||||
- (BOOL)configureUsingSettings:(NSData *)settings error:(out NSError * __autoreleasing _Nullable *)error {
|
||||
NSString *vpnConfiguration = [[NSString alloc] initWithData:settings encoding:NSUTF8StringEncoding];
|
||||
|
||||
if (vpnConfiguration == nil) {
|
||||
|
@ -8,11 +8,18 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
extern NSString * __nonnull const OpenVPNAdapterErrorDomain;
|
||||
|
||||
extern NSString * __nonnull const OpenVPNAdapterErrorFatalKey;
|
||||
extern NSString * __nonnull const OpenVPNAdapterErrorEventKey;
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
- OpenVPNErrorConfigurationFailure: <#OpenVPNErrorConfigurationFailure description#>
|
||||
- OpenVPNErrorClientFailure: <#OpenVPNErrorClientFailure description#>
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, OpenVPNError) {
|
||||
OpenVPNErrorConfigurationFailure,
|
||||
OpenVPNErrorClientFailure
|
||||
|
@ -8,7 +8,44 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
- OpenVPNEventDisconnected: <#OpenVPNEventDisconnected description#>
|
||||
- OpenVPNEventConnected: <#OpenVPNEventConnected description#>
|
||||
- OpenVPNEventReconnecting: <#OpenVPNEventReconnecting description#>
|
||||
- OpenVPNEventResolve: <#OpenVPNEventResolve description#>
|
||||
- OpenVPNEventWait: <#OpenVPNEventWait description#>
|
||||
- OpenVPNEventWaitProxy: <#OpenVPNEventWaitProxy description#>
|
||||
- OpenVPNEventConnecting: <#OpenVPNEventConnecting description#>
|
||||
- OpenVPNEventGetConfig: <#OpenVPNEventGetConfig description#>
|
||||
- OpenVPNEventAssignIP: <#OpenVPNEventAssignIP description#>
|
||||
- OpenVPNEventAddRoutes: <#OpenVPNEventAddRoutes description#>
|
||||
- OpenVPNEventEcho: <#OpenVPNEventEcho description#>
|
||||
- OpenVPNEventInfo: <#OpenVPNEventInfo description#>
|
||||
- OpenVPNEventPause: <#OpenVPNEventPause description#>
|
||||
- OpenVPNEventResume: <#OpenVPNEventResume description#>
|
||||
- OpenVPNEventTransportError: <#OpenVPNEventTransportError description#>
|
||||
- OpenVPNEventTunError: <#OpenVPNEventTunError description#>
|
||||
- OpenVPNEventClientRestart: <#OpenVPNEventClientRestart description#>
|
||||
- OpenVPNEventAuthFailed: <#OpenVPNEventAuthFailed description#>
|
||||
- OpenVPNEventCertVerifyFail: <#OpenVPNEventCertVerifyFail description#>
|
||||
- OpenVPNEventTLSVersionMin: <#OpenVPNEventTLSVersionMin description#>
|
||||
- OpenVPNEventClientHalt: <#OpenVPNEventClientHalt description#>
|
||||
- OpenVPNEventConnectionTimeout: <#OpenVPNEventConnectionTimeout description#>
|
||||
- OpenVPNEventInactiveTimeout: <#OpenVPNEventInactiveTimeout description#>
|
||||
- OpenVPNEventDynamicChallenge: <#OpenVPNEventDynamicChallenge description#>
|
||||
- OpenVPNEventProxyNeedCreds: <#OpenVPNEventProxyNeedCreds description#>
|
||||
- OpenVPNEventProxyError: <#OpenVPNEventProxyError description#>
|
||||
- OpenVPNEventTunSetupFailed: <#OpenVPNEventTunSetupFailed description#>
|
||||
- OpenVPNEventTunIfaceCreate: <#OpenVPNEventTunIfaceCreate description#>
|
||||
- OpenVPNEventTunIfaceDisabled: <#OpenVPNEventTunIfaceDisabled description#>
|
||||
- OpenVPNEventEPKIError: <#OpenVPNEventEPKIError description#>
|
||||
- OpenVPNEventEPKIInvalidAlias: <#OpenVPNEventEPKIInvalidAlias description#>
|
||||
- OpenVPNEventInitializationFailed: <#OpenVPNEventInitializationFailed description#>
|
||||
- OpenVPNEventConnectionFailed: <#OpenVPNEventConnectionFailed description#>
|
||||
- OpenVPNEventUnknown: <#OpenVPNEventUnknown description#>
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, OpenVPNEvent) {
|
||||
OpenVPNEventDisconnected,
|
||||
OpenVPNEventConnected,
|
||||
|
Loading…
Reference in New Issue
Block a user