mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-02-11 00:00:08 +08:00
Wrap connection info
This commit is contained in:
@@ -21,6 +21,12 @@
|
||||
C93779DC1EAE32880030A362 /* OpenVPNCredentials+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C93779D91EAE32880030A362 /* OpenVPNCredentials+Internal.h */; };
|
||||
C94605E91EAA656B00971516 /* OpenVPNConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C94605E81EAA656B00971516 /* OpenVPNConfigurationTests.swift */; };
|
||||
C94605EA1EAA65F200971516 /* OpenVPNConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C94605E81EAA656B00971516 /* OpenVPNConfigurationTests.swift */; };
|
||||
C9657A171EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = C9657A151EB0A7F800EFF210 /* OpenVPNConnectionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
C9657A181EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = C9657A151EB0A7F800EFF210 /* OpenVPNConnectionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
C9657A1D1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9657A1B1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h */; };
|
||||
C9657A1E1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9657A1B1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h */; };
|
||||
C9657A211EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9657A161EB0A7F800EFF210 /* OpenVPNConnectionInfo.mm */; };
|
||||
C9657A221EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9657A161EB0A7F800EFF210 /* OpenVPNConnectionInfo.mm */; };
|
||||
C98467A21EAA559B00272A9A /* local_key_auth.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = C98467A11EAA559B00272A9A /* local_key_auth.ovpn */; };
|
||||
C98467A31EAA559B00272A9A /* local_key_auth.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = C98467A11EAA559B00272A9A /* local_key_auth.ovpn */; };
|
||||
C98467A61EAA5B7700272A9A /* OpenVPNConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = C98467A41EAA5B7700272A9A /* OpenVPNConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -96,6 +102,9 @@
|
||||
C93779D41EAE32670030A362 /* OpenVPNCredentials.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNCredentials.mm; sourceTree = "<group>"; };
|
||||
C93779D91EAE32880030A362 /* OpenVPNCredentials+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNCredentials+Internal.h"; sourceTree = "<group>"; };
|
||||
C94605E81EAA656B00971516 /* OpenVPNConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenVPNConfigurationTests.swift; sourceTree = "<group>"; };
|
||||
C9657A151EB0A7F800EFF210 /* OpenVPNConnectionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNConnectionInfo.h; sourceTree = "<group>"; };
|
||||
C9657A161EB0A7F800EFF210 /* OpenVPNConnectionInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNConnectionInfo.mm; sourceTree = "<group>"; };
|
||||
C9657A1B1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNConnectionInfo+Internal.h"; sourceTree = "<group>"; };
|
||||
C98467A11EAA559B00272A9A /* local_key_auth.ovpn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = local_key_auth.ovpn; sourceTree = "<group>"; };
|
||||
C98467A41EAA5B7700272A9A /* OpenVPNConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNConfiguration.h; sourceTree = "<group>"; };
|
||||
C98467A51EAA5B7700272A9A /* OpenVPNConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNConfiguration.mm; sourceTree = "<group>"; };
|
||||
@@ -268,6 +277,9 @@
|
||||
C93779D31EAE32670030A362 /* OpenVPNCredentials.h */,
|
||||
C93779D91EAE32880030A362 /* OpenVPNCredentials+Internal.h */,
|
||||
C93779D41EAE32670030A362 /* OpenVPNCredentials.mm */,
|
||||
C9657A151EB0A7F800EFF210 /* OpenVPNConnectionInfo.h */,
|
||||
C9657A1B1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h */,
|
||||
C9657A161EB0A7F800EFF210 /* OpenVPNConnectionInfo.mm */,
|
||||
C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */,
|
||||
C9BB477C1E7173C700F3F98C /* OpenVPNAdapter+Internal.h */,
|
||||
C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */,
|
||||
@@ -359,6 +371,8 @@
|
||||
C98467A61EAA5B7700272A9A /* OpenVPNConfiguration.h in Headers */,
|
||||
C93779CE1EAE17F50030A362 /* OpenVPNConfigurationValues.h in Headers */,
|
||||
C9BB47601E71663A00F3F98C /* Umbrella-Header.h in Headers */,
|
||||
C9657A1D1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h in Headers */,
|
||||
C9657A171EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */,
|
||||
C9BB47811E7173C700F3F98C /* OpenVPNAdapter+Public.h in Headers */,
|
||||
C9BB47711E7171A100F3F98C /* OpenVPNError.h in Headers */,
|
||||
C9BB47801E7173C700F3F98C /* OpenVPNAdapter+Internal.h in Headers */,
|
||||
@@ -379,6 +393,8 @@
|
||||
C98467A71EAA5B7700272A9A /* OpenVPNConfiguration.h in Headers */,
|
||||
C93779D01EAE18730030A362 /* OpenVPNConfigurationValues.h in Headers */,
|
||||
C9D2ABE61EA20F99007EDF9D /* Umbrella-Header.h in Headers */,
|
||||
C9657A1E1EB0A8D800EFF210 /* OpenVPNConnectionInfo+Internal.h in Headers */,
|
||||
C9657A181EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */,
|
||||
C9D2ABE71EA20F99007EDF9D /* OpenVPNAdapter+Public.h in Headers */,
|
||||
C9D2ABE81EA20F99007EDF9D /* OpenVPNError.h in Headers */,
|
||||
C9D2ABE91EA20F99007EDF9D /* OpenVPNAdapter+Internal.h in Headers */,
|
||||
@@ -587,6 +603,7 @@
|
||||
C9BB477A1E7171ED00F3F98C /* OpenVPNClient.mm in Sources */,
|
||||
C93779CF1EAE17F50030A362 /* OpenVPNConfigurationValues.mm in Sources */,
|
||||
C9FD921B1E9A667600374FC4 /* ovpncli.cpp in Sources */,
|
||||
C9657A211EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */,
|
||||
C93779D71EAE32670030A362 /* OpenVPNCredentials.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -611,6 +628,7 @@
|
||||
C9D2ABDC1EA20F99007EDF9D /* OpenVPNClient.mm in Sources */,
|
||||
C9D2ABDE1EA20F99007EDF9D /* ovpncli.cpp in Sources */,
|
||||
C93779D11EAE18760030A362 /* OpenVPNConfigurationValues.mm in Sources */,
|
||||
C9657A221EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */,
|
||||
C93779D81EAE32670030A362 /* OpenVPNCredentials.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
19
OpenVPN Adapter/OpenVPNConnectionInfo+Internal.h
Normal file
19
OpenVPN Adapter/OpenVPNConnectionInfo+Internal.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// OpenVPNConnectionInfo+Internal.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <client/ovpncli.hpp>
|
||||
|
||||
#import "OpenVPNConnectionInfo.h"
|
||||
|
||||
using namespace openvpn;
|
||||
|
||||
@interface OpenVPNConnectionInfo (Internal)
|
||||
|
||||
- (instancetype)initWithConnectionInfo:(ClientAPI::ConnectionInfo)info;
|
||||
|
||||
@end
|
||||
29
OpenVPN Adapter/OpenVPNConnectionInfo.h
Normal file
29
OpenVPN Adapter/OpenVPNConnectionInfo.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// OpenVPNConnectionInfo.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
Class used to provide extra details about successful connection
|
||||
*/
|
||||
@interface OpenVPNConnectionInfo : NSObject
|
||||
|
||||
@property (readonly, nonatomic) BOOL defined;
|
||||
@property (nullable, readonly, nonatomic) NSString *user;
|
||||
@property (nullable, readonly, nonatomic) NSString *serverHost;
|
||||
@property (nullable, readonly, nonatomic) NSString *serverPort;
|
||||
@property (nullable, readonly, nonatomic) NSString *serverProto;
|
||||
@property (nullable, readonly, nonatomic) NSString *serverIP;
|
||||
@property (nullable, readonly, nonatomic) NSString *vpnIPv4;
|
||||
@property (nullable, readonly, nonatomic) NSString *vpnIPv6;
|
||||
@property (nullable, readonly, nonatomic) NSString *gatewayIPv4;
|
||||
@property (nullable, readonly, nonatomic) NSString *gatewayIPv6;
|
||||
@property (nullable, readonly, nonatomic) NSString *clientIP;
|
||||
@property (nullable, readonly, nonatomic) NSString *tunName;
|
||||
|
||||
@end
|
||||
36
OpenVPN Adapter/OpenVPNConnectionInfo.mm
Normal file
36
OpenVPN Adapter/OpenVPNConnectionInfo.mm
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// OpenVPNConnectionInfo.m
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import "OpenVPNConnectionInfo.h"
|
||||
#import "OpenVPNConnectionInfo+Internal.h"
|
||||
|
||||
using namespace openvpn;
|
||||
|
||||
@implementation OpenVPNConnectionInfo
|
||||
|
||||
- (instancetype)initWithConnectionInfo:(ClientAPI::ConnectionInfo)info
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_defined = info.defined;
|
||||
_user = !info.user.empty() ? [NSString stringWithUTF8String:info.user.c_str()] : nil;
|
||||
_serverHost = !info.serverHost.empty() ? [NSString stringWithUTF8String:info.serverHost.c_str()] : nil;
|
||||
_serverPort = !info.serverPort.empty() ? [NSString stringWithUTF8String:info.serverPort.c_str()] : nil;
|
||||
_serverProto = !info.serverProto.empty() ? [NSString stringWithUTF8String:info.serverProto.c_str()] : nil;
|
||||
_serverIP = !info.serverIp.empty() ? [NSString stringWithUTF8String:info.serverIp.c_str()] : nil;
|
||||
_vpnIPv4 = !info.vpnIp4.empty() ? [NSString stringWithUTF8String:info.vpnIp4.c_str()] : nil;
|
||||
_vpnIPv6 = !info.vpnIp6.empty() ? [NSString stringWithUTF8String:info.vpnIp6.c_str()] : nil;
|
||||
_gatewayIPv4 = !info.gw4.empty() ? [NSString stringWithUTF8String:info.gw4.c_str()] : nil;
|
||||
_gatewayIPv6 = !info.gw6.empty() ? [NSString stringWithUTF8String:info.gw6.c_str()] : nil;
|
||||
_clientIP = !info.clientIp.empty() ? [NSString stringWithUTF8String:info.clientIp.c_str()] : nil;
|
||||
_tunName = !info.tunName.empty() ? [NSString stringWithUTF8String:info.tunName.c_str()] : nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user