Add tvOS support

- Upgrade OpenSSL for tvOS Simulator on arm64
- Use own WireGuard fork on develop

Closes #337
This commit is contained in:
Davide De Rosa 2023-12-16 20:50:10 +01:00
parent c56bfd7224
commit 6101e92c3b
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
9 changed files with 54 additions and 44 deletions

View File

@ -23,8 +23,8 @@ jobs:
- name: Run tests
run: |
swift test
publish_release:
name: Tag release
publish_version:
name: Publish release
runs-on: ubuntu-latest
needs: run_tests
steps:
@ -49,7 +49,7 @@ jobs:
git commit -m "$COMMIT_MESSAGE"
git tag "v$VERSION" -m "$TAG_MESSAGE"
git push && git push --tags
- name: Publish release
- name: Publish
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.VERSION }}"

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for Apple TV. [#337](https://github.com/passepartoutvpn/tunnelkit/issues/337)
- Attach user data to VPN configuration. [#400](https://github.com/passepartoutvpn/tunnelkit/pull/400)
## 6.2.0 (2023-12-14)

View File

@ -1,34 +1,32 @@
{
"object": {
"pins" : [
{
"package": "openssl-apple",
"repositoryURL": "https://github.com/passepartoutvpn/openssl-apple",
"identity" : "openssl-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/openssl-apple",
"state" : {
"branch": null,
"revision" : "026702febcaebcbf9ea68f2fa66b017eba998cdf",
"version" : "3.2.105"
}
},
{
"package": "SwiftyBeaver",
"repositoryURL": "https://github.com/SwiftyBeaver/SwiftyBeaver",
"identity" : "swiftybeaver",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftyBeaver/SwiftyBeaver",
"state" : {
"branch": null,
"revision" : "12b5acf96d98f91d50de447369bd18df74600f1a",
"version" : "1.9.6"
}
},
{
"package": "WireGuardKit",
"repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple",
"identity" : "wireguard-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wireguard-apple",
"state" : {
"branch": null,
"revision": "73d9152fa0cb661db0348a1ac11dbbf998422a50",
"version": "1.0.17"
"branch" : "develop",
"revision" : "b79f0f150356d8200a64922ecf041dd020140aa0"
}
}
]
},
"version": 1
],
"version" : 2
}

View File

@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
@ -6,7 +6,9 @@ import PackageDescription
let package = Package(
name: "TunnelKit",
platforms: [
.iOS(.v15), .macOS(.v12)
.iOS(.v15),
.macOS(.v12),
.tvOS(.v17)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
@ -39,10 +41,11 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0"),
.package(url: "https://github.com/passepartoutvpn/openssl-apple", from: "3.2.0"),
// .package(name: "WireGuardKit", url: "https://git.zx2c4.com/wireguard-apple", .exact("1.0.15-26")),
.package(name: "WireGuardKit", url: "https://github.com/passepartoutvpn/wireguard-apple", .exact("1.0.17"))
// .package(name: "WireGuardKit", url: "https://github.com/passepartoutvpn/wireguard-apple", .revision("73d9152fa0cb661db0348a1ac11dbbf998422a50"))
.package(url: "https://github.com/passepartoutvpn/openssl-apple", from: "3.2.105"),
// .package(url: "https://git.zx2c4.com/wireguard-apple", .exact: Version("1.0.15-26")),
// .package(url: "https://github.com/passepartoutvpn/wireguard-apple", exact: Version("1.0.17")),
// .package(url: "https://github.com/passepartoutvpn/wireguard-apple", revision: "73d9152fa0cb661db0348a1ac11dbbf998422a50")
.package(url: "https://github.com/passepartoutvpn/wireguard-apple", branch: "develop")
// .package(name: "WireGuardKit", path: "../wireguard-apple")
],
targets: [
@ -118,7 +121,7 @@ let package = Package(
dependencies: [
"__TunnelKitUtils",
"TunnelKitCore",
"WireGuardKit",
.product(name: "WireGuardKit", package: "wireguard-apple"),
"SwiftyBeaver"
]),
.target(

View File

@ -38,7 +38,7 @@ import Foundation
#if os(iOS)
import NetworkExtension
import SystemConfiguration.CaptiveNetwork
#else
#elseif os(macOS)
import CoreWLAN
#endif
import SwiftyBeaver
@ -116,10 +116,12 @@ public class InterfaceObserver: NSObject {
NEHotspotNetwork.fetchCurrent {
completionHandler($0?.ssid)
}
#else
#elseif os(macOS)
let client = CWWiFiClient.shared()
let ssid = client.interfaces()?.compactMap { $0.ssid() }.first
completionHandler(ssid)
#else
completionHandler(nil)
#endif
}
}

View File

@ -38,8 +38,10 @@ public struct NetworkExtensionExtra {
/// Disconnects on sleep if `true`.
public var disconnectsOnSleep = false
#if !os(tvOS)
/// Enables best-effort kill switch.
public var killSwitch = false
#endif
/// Extra user configuration data.
public var userData: [String: Any]?

View File

@ -38,7 +38,7 @@ import NetworkExtension
import SwiftyBeaver
#if os(iOS)
import SystemConfiguration.CaptiveNetwork
#else
#elseif os(macOS)
import CoreWLAN
#endif
import TunnelKitCore

View File

@ -113,7 +113,9 @@ extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
}
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
protocolConfiguration.providerConfiguration = try asDictionary()
#if !os(tvOS)
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
#endif
return protocolConfiguration
}
}

View File

@ -86,7 +86,9 @@ extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
protocolConfiguration.passwordReference = extra?.passwordReference
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
protocolConfiguration.providerConfiguration = try asDictionary()
#if !os(tvOS)
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
#endif
return protocolConfiguration
}
}