From f53ad65bcdb02b7b546cec7c5842da8ebe86d5b3 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 7 Apr 2019 15:13:50 +0200 Subject: [PATCH 1/3] Default "Any" protocol to UDP endpoints Mitigates a potential issue with randomizeEndpoint where TCP endpoints might be picked with equal probability, resulting in poor performance out of the box. Let the user pick TCP endpoints manually. --- .../Model/Profiles/ProviderConnectionProfile.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift index b0d2170c..c032ec77 100644 --- a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift +++ b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift @@ -132,7 +132,15 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { if let proto = manualProtocol { builder.sessionConfiguration.endpointProtocols = [proto] } else { - builder.sessionConfiguration.endpointProtocols = preset.configuration.sessionConfiguration.endpointProtocols + + // restrict "Any" protocol to UDP, unless there are no UDP endpoints + let allEndpoints = preset.configuration.sessionConfiguration.endpointProtocols + var endpoints = allEndpoints?.filter { $0.socketType == .udp } + if endpoints?.isEmpty ?? true { + endpoints = allEndpoints + } + + builder.sessionConfiguration.endpointProtocols = endpoints // builder.sessionConfiguration.endpointProtocols = [ // EndpointProtocol(.udp, 8080), // EndpointProtocol(.tcp, 443) From bb4803fe1c1d897a5eba3485fddc8b57016266e9 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 7 Apr 2019 15:17:31 +0200 Subject: [PATCH 2/3] Rename Any to Automatic, makes more sense --- Passepartout/Resources/en.lproj/Localizable.strings | 4 ++-- Passepartout/Resources/it.lproj/Localizable.strings | 4 ++-- Passepartout/Sources/SwiftGen+Strings.swift | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index e0a82621..b3676522 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -148,8 +148,8 @@ "endpoint.sections.location_addresses.header" = "Addresses"; "endpoint.sections.location_protocols.header" = "Protocols"; -"endpoint.cells.any_address.caption" = "Any"; -"endpoint.cells.any_protocol.caption" = "Any"; +"endpoint.cells.any_address.caption" = "Automatic"; +"endpoint.cells.any_protocol.caption" = "Automatic"; "provider.preset.cells.tech_details.caption" = "Technical details"; //"provider.preset.sections.main.footer" = "Tap info button to disclose technical details."; diff --git a/Passepartout/Resources/it.lproj/Localizable.strings b/Passepartout/Resources/it.lproj/Localizable.strings index 7ec5ea13..d09d91af 100644 --- a/Passepartout/Resources/it.lproj/Localizable.strings +++ b/Passepartout/Resources/it.lproj/Localizable.strings @@ -144,8 +144,8 @@ "endpoint.sections.location_addresses.header" = "Indirizzi"; "endpoint.sections.location_protocols.header" = "Protocolli"; -"endpoint.cells.any_address.caption" = "Qualunque"; -"endpoint.cells.any_protocol.caption" = "Qualunque"; +"endpoint.cells.any_address.caption" = "Automatico"; +"endpoint.cells.any_protocol.caption" = "Automatico"; "provider.preset.cells.tech_details.caption" = "Dettagli tecnici"; //"provider.preset.sections.main.footer" = "Tap info button to disclose technical details."; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index ee5a6354..641eeda3 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -298,11 +298,11 @@ public enum L10n { public enum Endpoint { public enum Cells { public enum AnyAddress { - /// Any + /// Automatic public static let caption = L10n.tr("Localizable", "endpoint.cells.any_address.caption") } public enum AnyProtocol { - /// Any + /// Automatic public static let caption = L10n.tr("Localizable", "endpoint.cells.any_protocol.caption") } } From 3cc587becff8c7cb3e04a611476cb79d84c3a951 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 7 Apr 2019 15:26:00 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc3a2535..5d3975db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ProtonVPN provider. [#7](https://github.com/passepartoutvpn/passepartout-ios/issues/7) - Italian translations. [#58](https://github.com/passepartoutvpn/passepartout-ios/pull/58) +### Changed + +- Automatic protocol defaults to UDP endpoints. [#61](https://github.com/passepartoutvpn/passepartout-ios/pull/61) + ### Fixed - Some providers may crash on VPN activation. [#57](https://github.com/passepartoutvpn/passepartout-ios/issues/57)