Add support for tvOS

Include tvOS condition where iOS applies.

Signed-off-by: Davide De Rosa <keeshux@gmail.com>
This commit is contained in:
Davide De Rosa 2023-12-16 00:40:37 +01:00
parent 73d9152fa0
commit b79f0f1503
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
5 changed files with 8 additions and 5 deletions

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
@ -7,7 +7,8 @@ let package = Package(
name: "WireGuardKit",
platforms: [
.macOS(.v12),
.iOS(.v15)
.iOS(.v15),
.tvOS(.v17)
],
products: [
.library(name: "WireGuardKit", targets: ["WireGuardKit"])

View File

@ -92,7 +92,7 @@ extension DNSResolver {
extension Endpoint {
func withReresolvedIP() throws -> Endpoint {
#if os(iOS)
#if os(iOS) || os(tvOS)
let hostname: String
switch host {
case .name(let name, _):

View File

@ -116,7 +116,7 @@ class PacketTunnelSettingsGenerator {
* add a nob, maybe, or iOS will do probing for us.
*/
if mtu == 0 {
#if os(iOS)
#if os(iOS) || os(tvOS)
networkSettings.mtu = NSNumber(value: 1280)
#elseif os(macOS)
networkSettings.tunnelOverheadBytes = 80

View File

@ -420,7 +420,7 @@ public class WireGuardAdapter {
if case .started(let handle, _) = self.state {
wgBumpSockets(handle)
}
#elseif os(iOS)
#elseif os(iOS) || os(tvOS)
switch self.state {
case .started(let handle, let settingsGenerator):
if path.status.isSatisfiable {

View File

@ -24,6 +24,8 @@ GOARCH_x86_64 := amd64
GOOS_macosx := $(if $(IS_CATALYST),ios,darwin)
GOOS_iphoneos := ios
GOOS_iphonesimulator := ios
GOOS_appletvos := ios
GOOS_appletvsimulator := ios
TARGET ?= $(if $(IS_CATALYST),-target arm64-apple-ios14.0-macabi,)