From d1f794ae5728a3522d04d3703e48c69dae8cccab Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Thu, 26 Sep 2019 10:35:53 +0300 Subject: [PATCH] Expose tunPersist setting --- Sources/OpenVPNAdapter/OpenVPNConfiguration.h | 5 +++++ Sources/OpenVPNAdapter/OpenVPNConfiguration.mm | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/Sources/OpenVPNAdapter/OpenVPNConfiguration.h b/Sources/OpenVPNAdapter/OpenVPNConfiguration.h index f0a324a..4276997 100644 --- a/Sources/OpenVPNAdapter/OpenVPNConfiguration.h +++ b/Sources/OpenVPNAdapter/OpenVPNConfiguration.h @@ -64,6 +64,11 @@ typedef NS_ENUM(NSInteger, OpenVPNTLSCertProfile); */ @property (nonatomic) NSInteger connectionTimeout; +/** + Keep tun interface active during pauses or reconnections + */ +@property (nonatomic) BOOL tunPersist; + /** If YES and a redirect-gateway profile doesn't also define DNS servers, use the standard Google DNS servers. diff --git a/Sources/OpenVPNAdapter/OpenVPNConfiguration.mm b/Sources/OpenVPNAdapter/OpenVPNConfiguration.mm index bb8d414..42565d1 100644 --- a/Sources/OpenVPNAdapter/OpenVPNConfiguration.mm +++ b/Sources/OpenVPNAdapter/OpenVPNConfiguration.mm @@ -308,6 +308,14 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default"; _config.connTimeout = connectionTimeout; } +- (BOOL)tunPersist { + return _config.tunPersist; +} + +- (void)setTunPersist:(BOOL)tunPersist { + _config.tunPersist = tunPersist; +} + - (BOOL)googleDNSFallback { return _config.googleDnsFallback; } @@ -477,6 +485,7 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default"; configuration.proto = self.proto; configuration.ipv6 = self.ipv6; configuration.connectionTimeout = self.connectionTimeout; + configuration.tunPersist = self.tunPersist; configuration.googleDNSFallback = self.googleDNSFallback; configuration.synchronousDNSLookup = self.synchronousDNSLookup; configuration.autologinSessions = self.autologinSessions; @@ -503,6 +512,7 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default"; [aCoder encodeInteger:self.proto forKey:NSStringFromSelector(@selector(proto))]; [aCoder encodeInteger:self.ipv6 forKey:NSStringFromSelector(@selector(ipv6))]; [aCoder encodeInteger:self.connectionTimeout forKey:NSStringFromSelector(@selector(connectionTimeout))]; + [aCoder encodeBool:self.tunPersist forKey:NSStringFromSelector(@selector(tunPersist))]; [aCoder encodeBool:self.googleDNSFallback forKey:NSStringFromSelector(@selector(googleDNSFallback))]; [aCoder encodeBool:self.synchronousDNSLookup forKey:NSStringFromSelector(@selector(synchronousDNSLookup))]; [aCoder encodeBool:self.autologinSessions forKey:NSStringFromSelector(@selector(autologinSessions))]; @@ -529,6 +539,7 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default"; self.proto = (OpenVPNTransportProtocol)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(proto))]; self.ipv6 = (OpenVPNIPv6Preference)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(ipv6))]; self.connectionTimeout = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(connectionTimeout))]; + self.tunPersist = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(tunPersist))]; self.googleDNSFallback = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(googleDNSFallback))]; self.synchronousDNSLookup = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(synchronousDNSLookup))]; self.autologinSessions = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(autologinSessions))];