Attach user data to VPN configuration (#400)

This commit is contained in:
Davide De Rosa 2023-12-24 00:40:42 +01:00 committed by GitHub
parent bda84bf569
commit c56bfd7224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Attach user data to VPN configuration. [#400](https://github.com/passepartoutvpn/tunnelkit/pull/400)
## 6.2.0 (2023-12-14)
### Changed

View File

@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/passepartoutvpn/openssl-apple",
"state": {
"branch": null,
"revision": "c15562540646602300df94540765fbe27b6d5474",
"version": "3.2.0"
"revision": "026702febcaebcbf9ea68f2fa66b017eba998cdf",
"version": "3.2.105"
}
},
{
@ -24,7 +24,7 @@
"repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple",
"state": {
"branch": null,
"revision": "57f9babde0fb7567f31a75e943538022f8725f8f",
"revision": "73d9152fa0cb661db0348a1ac11dbbf998422a50",
"version": "1.0.17"
}
}

View File

@ -41,6 +41,9 @@ public struct NetworkExtensionExtra {
/// Enables best-effort kill switch.
public var killSwitch = false
/// Extra user configuration data.
public var userData: [String: Any]?
public init() {
}
}

View File

@ -140,6 +140,10 @@ public class NetworkExtensionVPN: VPN {
)
let managers = try await lookupAll()
extra?.userData?.forEach {
proto.providerConfiguration?[$0.key] = $0.value
}
// install (new or existing) then callback
let targetManager = managers.first {
$0.isTunnel(withIdentifier: tunnelBundleIdentifier)