Return expiration and platform

This commit is contained in:
Sergey Abramchuk
2017-04-30 19:15:41 +03:00
parent 0ca03b10c9
commit 7d9f0abe76
2 changed files with 20 additions and 0 deletions

View File

@@ -124,6 +124,16 @@ NS_SWIFT_NAME(handle(logMessage:));
*/
@property (nonnull, readonly, nonatomic) OpenVPNInterfaceStats *interfaceStats;
/**
Returns date/time of app expiration
*/
+ (nonnull NSDate *)expiration;
/**
Returns platform description
*/
+ (nonnull NSString *)platform;
/**
<#Description#>

View File

@@ -158,6 +158,16 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
return [[OpenVPNInterfaceStats alloc] initWithInterfaceStats:stats];
}
+ (NSDate *)expiration {
NSNumber *time = [NSNumber numberWithInteger:OpenVPNClient::app_expire()];
return [NSDate dateWithTimeIntervalSince1970:[time doubleValue]];
}
+ (NSString *)platform {
std::string platform = OpenVPNClient::platform();
return [NSString stringWithUTF8String:platform.c_str()];
}
#pragma mark Client Configuration
- (OpenVPNProperties *)applyConfiguration:(nonnull OpenVPNConfiguration *)configuration error:(out NSError * __nullable * __nullable)error {