From f6e0caaa73ab2d08fd8b386c5b416e825e743551 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 16 Oct 2022 14:19:36 +0200 Subject: [PATCH] Implement --remote-random-hostname - Update TunnelKit - Show in UI --- CHANGELOG.md | 6 ++++++ .../xcshareddata/swiftpm/Package.resolved | 2 +- .../App/Views/EndpointAdvancedView+OpenVPN.swift | 12 ++++++++---- .../AppShared/Constants/SwiftGen+Strings.swift | 4 ++++ Passepartout/AppShared/L10n/OpenVPN+L10n.swift | 5 +++++ Passepartout/AppShared/en.lproj/Localizable.strings | 1 + PassepartoutLibrary/Package.swift | 2 +- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b59bd6..f85a7c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 + +- OpenVPN: Support for `--remote-random-hostname`. [tunnelkit#286](https://github.com/passepartoutvpn/tunnelkit/pull/286) + ## 2.0.1 (2022-10-17) ### Added diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9e712538..07cc8c8f 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -51,7 +51,7 @@ "repositoryURL": "https://github.com/passepartoutvpn/tunnelkit", "state": { "branch": null, - "revision": "8df7e90c95dc1af66b27990b5f00ba21120e9f9d", + "revision": "17c272d733a827bb694dd352890f8651d6ce6ec2", "version": null } }, diff --git a/Passepartout/App/Views/EndpointAdvancedView+OpenVPN.swift b/Passepartout/App/Views/EndpointAdvancedView+OpenVPN.swift index 995ae85e..e391555c 100644 --- a/Passepartout/App/Views/EndpointAdvancedView+OpenVPN.swift +++ b/Passepartout/App/Views/EndpointAdvancedView+OpenVPN.swift @@ -288,10 +288,14 @@ extension EndpointAdvancedView.OpenVPNView { Text(L10n.Endpoint.Advanced.Openvpn.Items.RenegotiationSeconds.caption) .withTrailingText($0.localizedDescriptionAsRenegotiatesAfter) } - settings.randomize.map { + settings.randomizeEndpoint.map { Text(L10n.Endpoint.Advanced.Openvpn.Items.RandomEndpoint.caption) .withTrailingText($0.localizedDescriptionAsRandomizeEndpoint) } + settings.randomizeHostnames.map { + Text(L10n.Endpoint.Advanced.Openvpn.Items.RandomHostname.caption) + .withTrailingText($0.localizedDescriptionAsRandomizeHostnames) + } } header: { Text(L10n.Endpoint.Advanced.Openvpn.Sections.Other.header) } @@ -328,11 +332,11 @@ extension OpenVPN.Configuration { return (httpsProxy ?? httpProxy, proxyAutoConfigurationURL, proxyBypassDomains ?? []) } - var otherSettings: (keepAlive: TimeInterval?, reneg: TimeInterval?, randomize: Bool?)? { - guard keepAliveInterval != nil || renegotiatesAfter != nil || randomizeEndpoint != nil else { + var otherSettings: (keepAlive: TimeInterval?, reneg: TimeInterval?, randomizeEndpoint: Bool?, randomizeHostnames: Bool?)? { + guard keepAliveInterval != nil || renegotiatesAfter != nil || randomizeEndpoint != nil || randomizeHostnames != nil else { return nil } - return (keepAliveInterval, renegotiatesAfter, randomizeEndpoint) + return (keepAliveInterval, renegotiatesAfter, randomizeEndpoint, randomizeHostnames) } } diff --git a/Passepartout/AppShared/Constants/SwiftGen+Strings.swift b/Passepartout/AppShared/Constants/SwiftGen+Strings.swift index ec86c427..6b82abdf 100644 --- a/Passepartout/AppShared/Constants/SwiftGen+Strings.swift +++ b/Passepartout/AppShared/Constants/SwiftGen+Strings.swift @@ -334,6 +334,10 @@ internal enum L10n { /// Randomize endpoint internal static let caption = L10n.tr("Localizable", "endpoint.advanced.openvpn.items.random_endpoint.caption", fallback: "Randomize endpoint") } + internal enum RandomHostname { + /// Randomize hostnames + internal static let caption = L10n.tr("Localizable", "endpoint.advanced.openvpn.items.random_hostname.caption", fallback: "Randomize hostnames") + } internal enum RenegotiationSeconds { /// Renegotiation internal static let caption = L10n.tr("Localizable", "endpoint.advanced.openvpn.items.renegotiation_seconds.caption", fallback: "Renegotiation") diff --git a/Passepartout/AppShared/L10n/OpenVPN+L10n.swift b/Passepartout/AppShared/L10n/OpenVPN+L10n.swift index c9ea4755..05e2d86a 100644 --- a/Passepartout/AppShared/L10n/OpenVPN+L10n.swift +++ b/Passepartout/AppShared/L10n/OpenVPN+L10n.swift @@ -119,6 +119,11 @@ extension Bool { let V = L10n.Global.Strings.self return self ? V.enabled : V.disabled } + + var localizedDescriptionAsRandomizeHostnames: String { + let V = L10n.Global.Strings.self + return self ? V.enabled : V.disabled + } } extension OpenVPN.PullMask { diff --git a/Passepartout/AppShared/en.lproj/Localizable.strings b/Passepartout/AppShared/en.lproj/Localizable.strings index b29e139d..a443a514 100644 --- a/Passepartout/AppShared/en.lproj/Localizable.strings +++ b/Passepartout/AppShared/en.lproj/Localizable.strings @@ -227,6 +227,7 @@ "endpoint.advanced.openvpn.items.renegotiation_seconds.caption" = "Renegotiation"; "endpoint.advanced.openvpn.items.renegotiation_seconds.value.after" = "after %@"; "endpoint.advanced.openvpn.items.random_endpoint.caption" = "Randomize endpoint"; +"endpoint.advanced.openvpn.items.random_hostname.caption" = "Randomize hostnames"; /* MARK: ProfileView -> NetworkSettingsView */ diff --git a/PassepartoutLibrary/Package.swift b/PassepartoutLibrary/Package.swift index a9d60fff..746b3bf5 100644 --- a/PassepartoutLibrary/Package.swift +++ b/PassepartoutLibrary/Package.swift @@ -24,7 +24,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), // .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", from: "5.0.0"), - .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("8df7e90c95dc1af66b27990b5f00ba21120e9f9d")), + .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("17c272d733a827bb694dd352890f8651d6ce6ec2")), // .package(name: "TunnelKit", path: "../../tunnelkit"), .package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"), .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0")