mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Return the methods and configurations related to the tun builder which were removed after merging
This commit is contained in:
@@ -11,18 +11,90 @@
|
||||
#import "OpenVPNAdapter+Internal.h"
|
||||
#import "OpenVPNClient.h"
|
||||
|
||||
OpenVPNClient::OpenVPNClient(void* adapter) : ClientAPI::OpenVPNClient() {
|
||||
OpenVPNClient::OpenVPNClient(void *adapter) : ClientAPI::OpenVPNClient() {
|
||||
this->adapter = adapter;
|
||||
}
|
||||
|
||||
TunClientFactory* OpenVPNClient::new_tun_factory(const ExternalTun::Config& conf, const OptionList& opt) {
|
||||
return this;
|
||||
bool OpenVPNClient::tun_builder_new() {
|
||||
return [(__bridge OpenVPNAdapter *)adapter configureSockets];
|
||||
}
|
||||
|
||||
TunClient::Ptr OpenVPNClient::new_tun_client_obj(openvpn_io::io_context& io_context, TunClientParent& parent, TransportClient* transcli) {
|
||||
return nullptr;
|
||||
bool OpenVPNClient::tun_builder_set_remote_address(const std::string &address, bool ipv6) {
|
||||
NSString *remoteAddress = [NSString stringWithUTF8String:address.c_str()];
|
||||
return [(__bridge OpenVPNAdapter *)adapter setRemoteAddress:remoteAddress isIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_address(const std::string &address, int prefix_length, const std::string &gateway, bool ipv6, bool net30) {
|
||||
NSString *localAddress = [NSString stringWithUTF8String:address.c_str()];
|
||||
NSString *gatewayAddress = [NSString stringWithUTF8String:gateway.c_str()];
|
||||
|
||||
return [(__bridge OpenVPNAdapter *)adapter addLocalAddress:localAddress prefixLength:@(prefix_length) gateway:gatewayAddress isIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_reroute_gw(bool ipv4, bool ipv6, unsigned int flags) {
|
||||
return [(__bridge OpenVPNAdapter *)adapter defaultGatewayRerouteIPv4:ipv4 rerouteIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_route(const std::string& address, int prefix_length, int metric, bool ipv6) {
|
||||
NSString *route = [NSString stringWithUTF8String:address.c_str()];
|
||||
return [(__bridge OpenVPNAdapter *)adapter addRoute:route prefixLength:@(prefix_length) isIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_exclude_route(const std::string& address, int prefix_length, int metric, bool ipv6) {
|
||||
NSString *route = [NSString stringWithUTF8String:address.c_str()];
|
||||
return [(__bridge OpenVPNAdapter *)adapter excludeRoute:route prefixLength:@(prefix_length) isIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_dns_server(const std::string& address, bool ipv6) {
|
||||
NSString *dnsAddress = [NSString stringWithUTF8String:address.c_str()];
|
||||
return [(__bridge OpenVPNAdapter *)adapter addDNSAddress:dnsAddress isIPv6:ipv6];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_search_domain(const std::string& domain) {
|
||||
NSString *searchDomain = [NSString stringWithUTF8String:domain.c_str()];
|
||||
return [(__bridge OpenVPNAdapter *)adapter addSearchDomain:searchDomain];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_set_mtu(int mtu) {
|
||||
return [(__bridge OpenVPNAdapter *)adapter setMTU:@(mtu)];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_set_session_name(const std::string& name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_proxy_bypass(const std::string& bypass_host) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_set_proxy_auto_config_url(const std::string& url) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_set_proxy_http(const std::string& host, int port) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_set_proxy_https(const std::string& host, int port) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_add_wins_server(const std::string& address) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int OpenVPNClient::tun_builder_establish() {
|
||||
return (int)[(__bridge OpenVPNAdapter *)adapter establishTunnel];
|
||||
}
|
||||
|
||||
bool OpenVPNClient::tun_builder_persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenVPNClient::tun_builder_establish_lite() { }
|
||||
|
||||
void OpenVPNClient::tun_builder_teardown(bool disconnect) { }
|
||||
|
||||
bool OpenVPNClient::socket_protect(int socket) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user