Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Attach user data to VPN configuration (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux authored Dec 23, 2023
1 parent bda84bf commit c56bfd7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand All @@ -24,7 +24,7 @@
"repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple",
"state": {
"branch": null,
"revision": "57f9babde0fb7567f31a75e943538022f8725f8f",
"revision": "73d9152fa0cb661db0348a1ac11dbbf998422a50",
"version": "1.0.17"
}
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/TunnelKitManager/NetworkExtensionConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
}
Expand Down
4 changes: 4 additions & 0 deletions Sources/TunnelKitManager/NetworkExtensionVPN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c56bfd7

Please sign in to comment.