Use active profile name in VPN configuration

Rather than "Passepartout", as seen in device settings.
This commit is contained in:
Davide De Rosa 2020-07-02 19:14:17 +02:00
parent 7d2184d205
commit 683617ddd4
3 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Changed
- Use active profile name in VPN configuration (device settings).
### Fixed ### Fixed
- Incorrect tunnel bundle identifiers in Demo. [#176](https://github.com/passepartoutvpn/tunnelkit/issues/176) - Incorrect tunnel bundle identifiers in Demo. [#176](https://github.com/passepartoutvpn/tunnelkit/issues/176)

View File

@ -99,6 +99,7 @@ public class StandardVPNProvider: VPNProvider {
return return
} }
self.manager = manager self.manager = manager
manager.localizedDescription = configuration.title
manager.protocolConfiguration = configuration.protocolConfiguration manager.protocolConfiguration = configuration.protocolConfiguration
manager.onDemandRules = configuration.onDemandRules manager.onDemandRules = configuration.onDemandRules
manager.isOnDemandEnabled = true manager.isOnDemandEnabled = true

View File

@ -28,11 +28,17 @@ import NetworkExtension
/// Generic marker for objects able to configure a `VPNProvider`. /// Generic marker for objects able to configure a `VPNProvider`.
public protocol VPNConfiguration { public protocol VPNConfiguration {
/// The profile title in device settings.
var title: String { get }
} }
/// A `VPNConfiguration` built on top of NetworkExtension entities. /// A `VPNConfiguration` built on top of NetworkExtension entities.
public struct NetworkExtensionVPNConfiguration: VPNConfiguration { public struct NetworkExtensionVPNConfiguration: VPNConfiguration {
/// :nodoc:
public var title: String
/// The `NETunnelProviderProtocol` object embedding tunnel configuration. /// The `NETunnelProviderProtocol` object embedding tunnel configuration.
public let protocolConfiguration: NETunnelProviderProtocol public let protocolConfiguration: NETunnelProviderProtocol
@ -40,7 +46,8 @@ public struct NetworkExtensionVPNConfiguration: VPNConfiguration {
public let onDemandRules: [NEOnDemandRule] public let onDemandRules: [NEOnDemandRule]
/// :nodoc: /// :nodoc:
public init(protocolConfiguration: NETunnelProviderProtocol, onDemandRules: [NEOnDemandRule]) { public init(title: String, protocolConfiguration: NETunnelProviderProtocol, onDemandRules: [NEOnDemandRule]) {
self.title = title
self.protocolConfiguration = protocolConfiguration self.protocolConfiguration = protocolConfiguration
self.onDemandRules = onDemandRules self.onDemandRules = onDemandRules
} }