mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
OpenVPNClient should be responsible for copying of config
This commit is contained in:
@@ -48,8 +48,7 @@
|
|||||||
#pragma mark - OpenVPNClient Lifecycle
|
#pragma mark - OpenVPNClient Lifecycle
|
||||||
|
|
||||||
- (OpenVPNProperties *)applyConfiguration:(OpenVPNConfiguration *)configuration error:(NSError * __autoreleasing *)error {
|
- (OpenVPNProperties *)applyConfiguration:(OpenVPNConfiguration *)configuration error:(NSError * __autoreleasing *)error {
|
||||||
ClientAPI::Config *config = new ClientAPI::Config(configuration.config);
|
ClientAPI::EvalConfig eval = self.vpnClient->apply_config(configuration.config);
|
||||||
ClientAPI::EvalConfig eval = self.vpnClient->apply_config(config);
|
|
||||||
|
|
||||||
if (eval.error) {
|
if (eval.error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
OpenVPNClient(id<OpenVPNClientDelegate> _Nonnull delegate);
|
OpenVPNClient(id<OpenVPNClientDelegate> _Nonnull delegate);
|
||||||
~OpenVPNClient();
|
~OpenVPNClient();
|
||||||
|
|
||||||
ClientAPI::EvalConfig apply_config(ClientAPI::Config* _Nonnull config);
|
ClientAPI::EvalConfig apply_config(const ClientAPI::Config& config);
|
||||||
|
|
||||||
bool tun_builder_new() override;
|
bool tun_builder_new() override;
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ OpenVPNClient::~OpenVPNClient() {
|
|||||||
if (this->config != nullptr) { delete this->config; }
|
if (this->config != nullptr) { delete this->config; }
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientAPI::EvalConfig OpenVPNClient::apply_config(ClientAPI::Config* _Nonnull config) {
|
ClientAPI::EvalConfig OpenVPNClient::apply_config(const ClientAPI::Config& config) {
|
||||||
if (this->config != nullptr) { delete this->config; }
|
if (this->config != nullptr) { delete this->config; }
|
||||||
this->config = config;
|
this->config = new ClientAPI::Config(config);
|
||||||
|
|
||||||
return eval_config(*config);
|
return eval_config(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenVPNClient::tun_builder_new() {
|
bool OpenVPNClient::tun_builder_new() {
|
||||||
|
|||||||
Reference in New Issue
Block a user