mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-02-11 00:00:08 +08:00
Return connection info
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
@class OpenVPNConfiguration;
|
||||
@class OpenVPNProperties;
|
||||
@class OpenVPNCredentials;
|
||||
@class OpenVPNConnectionInfo;
|
||||
@class NEPacketTunnelNetworkSettings;
|
||||
|
||||
// TODO: Add documentation to properties and methods
|
||||
@@ -99,6 +100,12 @@ NS_SWIFT_NAME(handle(logMessage:));
|
||||
*/
|
||||
@property (weak, nonatomic, null_unspecified) id<OpenVPNAdapterDelegate> delegate;
|
||||
|
||||
/**
|
||||
Return information about the most recent connection. Will be available
|
||||
after an event of type "CONNECTED, otherwise return nil
|
||||
*/
|
||||
@property (nullable, readonly, nonatomic) OpenVPNConnectionInfo *connectionInfo;
|
||||
|
||||
/**
|
||||
<#Description#>
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
|
||||
|
||||
@end
|
||||
|
||||
@implementation OpenVPNAdapter (Provider)
|
||||
@implementation OpenVPNAdapter (Public)
|
||||
|
||||
#pragma mark Properties
|
||||
|
||||
@@ -133,6 +133,12 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
- (OpenVPNConnectionInfo *)connectionInfo {
|
||||
// TODO: Check correctness of using "defined" property
|
||||
ClientAPI::ConnectionInfo info = self.vpnClient->connection_info();
|
||||
return info.defined ? [[OpenVPNConnectionInfo alloc] initWithConnectionInfo:info] : nil;
|
||||
}
|
||||
|
||||
#pragma mark Client Configuration
|
||||
|
||||
- (OpenVPNProperties *)applyConfiguration:(nonnull OpenVPNConfiguration *)configuration error:(out NSError * __nullable * __nullable)error {
|
||||
|
||||
Reference in New Issue
Block a user