mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Return session token
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
@class OpenVPNProperties;
|
@class OpenVPNProperties;
|
||||||
@class OpenVPNCredentials;
|
@class OpenVPNCredentials;
|
||||||
@class OpenVPNConnectionInfo;
|
@class OpenVPNConnectionInfo;
|
||||||
|
@class OpenVPNSessionToken;
|
||||||
@class OpenVPNTransportStats;
|
@class OpenVPNTransportStats;
|
||||||
@class OpenVPNInterfaceStats;
|
@class OpenVPNInterfaceStats;
|
||||||
@class NEPacketTunnelNetworkSettings;
|
@class NEPacketTunnelNetworkSettings;
|
||||||
@@ -104,10 +105,15 @@ NS_SWIFT_NAME(handle(logMessage:));
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Return information about the most recent connection. Will be available
|
Return information about the most recent connection. Will be available
|
||||||
after an event of type "CONNECTED, otherwise return nil.
|
after an event of type "OpenVPNEventConnected, otherwise return nil.
|
||||||
*/
|
*/
|
||||||
@property (nullable, readonly, nonatomic) OpenVPNConnectionInfo *connectionInfo;
|
@property (nullable, readonly, nonatomic) OpenVPNConnectionInfo *connectionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return current session token or nil if session token is unavailable
|
||||||
|
*/
|
||||||
|
@property (nullable, readonly, nonatomic) OpenVPNSessionToken *sessionToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return transport stats
|
Return transport stats
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#import "OpenVPNCredentials+Internal.h"
|
#import "OpenVPNCredentials+Internal.h"
|
||||||
#import "OpenVPNProperties+Internal.h"
|
#import "OpenVPNProperties+Internal.h"
|
||||||
#import "OpenVPNConnectionInfo+Internal.h"
|
#import "OpenVPNConnectionInfo+Internal.h"
|
||||||
|
#import "OpenVPNSessionToken+Internal.h"
|
||||||
#import "OpenVPNTransportStats+Internal.h"
|
#import "OpenVPNTransportStats+Internal.h"
|
||||||
#import "OpenVPNInterfaceStats+Internal.h"
|
#import "OpenVPNInterfaceStats+Internal.h"
|
||||||
#import "OpenVPNAdapter.h"
|
#import "OpenVPNAdapter.h"
|
||||||
@@ -136,11 +137,17 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (OpenVPNConnectionInfo *)connectionInfo {
|
- (OpenVPNConnectionInfo *)connectionInfo {
|
||||||
// TODO: Check correctness of using "defined" property
|
|
||||||
ClientAPI::ConnectionInfo info = self.vpnClient->connection_info();
|
ClientAPI::ConnectionInfo info = self.vpnClient->connection_info();
|
||||||
return info.defined ? [[OpenVPNConnectionInfo alloc] initWithConnectionInfo:info] : nil;
|
return info.defined ? [[OpenVPNConnectionInfo alloc] initWithConnectionInfo:info] : nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OpenVPNSessionToken *)sessionToken {
|
||||||
|
ClientAPI::SessionToken token;
|
||||||
|
bool gotToken = self.vpnClient->session_token(token);
|
||||||
|
|
||||||
|
return gotToken ? [[OpenVPNSessionToken alloc] initWithSessionToken:token] : nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (OpenVPNTransportStats *)transportStats {
|
- (OpenVPNTransportStats *)transportStats {
|
||||||
ClientAPI::TransportStats stats = self.vpnClient->transport_stats();
|
ClientAPI::TransportStats stats = self.vpnClient->transport_stats();
|
||||||
return [[OpenVPNTransportStats alloc] initWithTransportStats:stats];
|
return [[OpenVPNTransportStats alloc] initWithTransportStats:stats];
|
||||||
|
|||||||
Reference in New Issue
Block a user