mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Update name of configuration method and add templates for documentation
This commit is contained in:
@@ -14,43 +14,111 @@
|
|||||||
|
|
||||||
// TODO: Add documentation to properties and methods
|
// TODO: Add documentation to properties and methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@protocol OpenVPNAdapterPacketFlow <NSObject>
|
@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;
|
- (BOOL)writePackets:(nonnull NSArray<NSData *> *)packets withProtocols:(nonnull NSArray<NSNumber *> *)protocols;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@protocol OpenVPNAdapterDelegate <NSObject>
|
@protocol OpenVPNAdapterDelegate <NSObject>
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
|
||||||
|
@param settings <#settings description#>
|
||||||
|
@param callback <#callback description#>
|
||||||
|
*/
|
||||||
- (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings
|
- (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings
|
||||||
callback:(nonnull void (^)(id<OpenVPNAdapterPacketFlow> _Nullable flow))callback
|
callback:(nonnull void (^)(id<OpenVPNAdapterPacketFlow> _Nullable flow))callback
|
||||||
NS_SWIFT_NAME(configureTunnel(settings:callback:));
|
NS_SWIFT_NAME(configureTunnel(settings:callback:));
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
|
||||||
|
@param event <#event description#>
|
||||||
|
@param message <#message description#>
|
||||||
|
*/
|
||||||
- (void)handleEvent:(OpenVPNEvent)event
|
- (void)handleEvent:(OpenVPNEvent)event
|
||||||
message:(nullable NSString *)message
|
message:(nullable NSString *)message
|
||||||
NS_SWIFT_NAME(handle(event:message:));
|
NS_SWIFT_NAME(handle(event:message:));
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
|
||||||
|
@param error <#error description#>
|
||||||
|
*/
|
||||||
- (void)handleError:(nonnull NSError *)error
|
- (void)handleError:(nonnull NSError *)error
|
||||||
NS_SWIFT_NAME(handle(error:));
|
NS_SWIFT_NAME(handle(error:));
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
|
||||||
|
@param logMessage <#logMessage description#>
|
||||||
|
*/
|
||||||
- (void)handleLog:(nonnull NSString *)logMessage
|
- (void)handleLog:(nonnull NSString *)logMessage
|
||||||
NS_SWIFT_NAME(handle(logMessage:));
|
NS_SWIFT_NAME(handle(logMessage:));
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@interface OpenVPNAdapter (Provider)
|
@interface OpenVPNAdapter (Provider)
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@property (strong, nonatomic, nullable) NSString *username;
|
@property (strong, nonatomic, nullable) NSString *username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@property (strong, nonatomic, nullable) NSString *password;
|
@property (strong, nonatomic, nullable) NSString *password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
*/
|
||||||
@property (weak, nonatomic, null_unspecified) id<OpenVPNAdapterDelegate> delegate;
|
@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
|
error:(out NSError * __nullable * __nullable)error
|
||||||
NS_SWIFT_NAME(configure(using:));
|
NS_SWIFT_NAME(configure(using:));
|
||||||
|
|
||||||
|
/**
|
||||||
|
Establish connection with the VPN server
|
||||||
|
*/
|
||||||
- (void)connect;
|
- (void)connect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Close connection with the VPN server
|
||||||
|
*/
|
||||||
- (void)disconnect;
|
- (void)disconnect;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
|
|||||||
|
|
||||||
#pragma mark Client Configuration
|
#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];
|
NSString *vpnConfiguration = [[NSString alloc] initWithData:settings encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
if (vpnConfiguration == nil) {
|
if (vpnConfiguration == nil) {
|
||||||
|
|||||||
@@ -8,11 +8,18 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
|
||||||
extern NSString * __nonnull const OpenVPNAdapterErrorDomain;
|
extern NSString * __nonnull const OpenVPNAdapterErrorDomain;
|
||||||
|
|
||||||
extern NSString * __nonnull const OpenVPNAdapterErrorFatalKey;
|
extern NSString * __nonnull const OpenVPNAdapterErrorFatalKey;
|
||||||
extern NSString * __nonnull const OpenVPNAdapterErrorEventKey;
|
extern NSString * __nonnull const OpenVPNAdapterErrorEventKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
<#Description#>
|
||||||
|
|
||||||
|
- OpenVPNErrorConfigurationFailure: <#OpenVPNErrorConfigurationFailure description#>
|
||||||
|
- OpenVPNErrorClientFailure: <#OpenVPNErrorClientFailure description#>
|
||||||
|
*/
|
||||||
typedef NS_ENUM(NSUInteger, OpenVPNError) {
|
typedef NS_ENUM(NSUInteger, OpenVPNError) {
|
||||||
OpenVPNErrorConfigurationFailure,
|
OpenVPNErrorConfigurationFailure,
|
||||||
OpenVPNErrorClientFailure
|
OpenVPNErrorClientFailure
|
||||||
|
|||||||
@@ -8,7 +8,44 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#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) {
|
typedef NS_ENUM(NSUInteger, OpenVPNEvent) {
|
||||||
OpenVPNEventDisconnected,
|
OpenVPNEventDisconnected,
|
||||||
OpenVPNEventConnected,
|
OpenVPNEventConnected,
|
||||||
|
|||||||
Reference in New Issue
Block a user