Make hostname optional in provider pool
E.g. ProtonVPN SecureCore servers don't provide a hostname.
This commit is contained in:
parent
bce7442ad1
commit
89d7c6924d
|
@ -495,7 +495,6 @@ public class ConnectionService: Codable {
|
|||
let protocolConfiguration = try cfg.generatedTunnelProtocol(
|
||||
withBundleIdentifier: GroupConstants.App.tunnelIdentifier,
|
||||
appGroup: appGroup,
|
||||
hostname: profile.mainAddress,
|
||||
credentials: creds
|
||||
)
|
||||
protocolConfiguration.disconnectOnSleep = preferences.disconnectsOnSleep
|
||||
|
|
|
@ -27,7 +27,7 @@ import Foundation
|
|||
import TunnelKit
|
||||
|
||||
public protocol EndpointDataSource {
|
||||
var mainAddress: String { get }
|
||||
var mainAddress: String? { get }
|
||||
|
||||
var addresses: [String] { get }
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public extension HostConnectionProfile {
|
|||
}
|
||||
|
||||
public extension HostConnectionProfile {
|
||||
var mainAddress: String {
|
||||
var mainAddress: String? {
|
||||
return hostname
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class PlaceholderConnectionProfile: ConnectionProfile {
|
|||
return PlaceholderConnectionProfile(context, newId)
|
||||
}
|
||||
|
||||
public var mainAddress: String = ""
|
||||
public var mainAddress: String? = nil
|
||||
|
||||
public var addresses: [String] = []
|
||||
|
||||
|
|
|
@ -121,7 +121,9 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||
builder.debugLogFormat = configuration.debugLogFormat
|
||||
builder.masksPrivateData = configuration.masksPrivateData
|
||||
|
||||
if let address = manualAddress {
|
||||
if builder.sessionConfiguration.hostname == nil {
|
||||
builder.resolvedAddresses = pool.addresses()
|
||||
} else if let address = manualAddress {
|
||||
builder.prefersResolvedAddresses = true
|
||||
builder.resolvedAddresses = [address]
|
||||
} else {
|
||||
|
@ -161,9 +163,9 @@ public extension ProviderConnectionProfile {
|
|||
}
|
||||
|
||||
public extension ProviderConnectionProfile {
|
||||
var mainAddress: String {
|
||||
var mainAddress: String? {
|
||||
assert(pool != nil, "Getting provider main address but no pool set")
|
||||
return pool?.hostname ?? ""
|
||||
return pool?.hostname
|
||||
}
|
||||
|
||||
var addresses: [String] {
|
||||
|
|
|
@ -75,7 +75,7 @@ public struct Pool: Codable, Hashable, Comparable, CustomStringConvertible {
|
|||
|
||||
// public let location: (Double, Double)
|
||||
|
||||
public let hostname: String
|
||||
public let hostname: String?
|
||||
|
||||
public let numericAddresses: [UInt32]
|
||||
|
||||
|
@ -89,7 +89,9 @@ public struct Pool: Codable, Hashable, Comparable, CustomStringConvertible {
|
|||
// XXX: inefficient, can't easily use lazy on struct
|
||||
public func addresses() -> [String] {
|
||||
var addrs = numericAddresses.map { DNSResolver.string(fromIPv4: $0) }
|
||||
addrs.insert(hostname, at: 0)
|
||||
if let hostname = hostname {
|
||||
addrs.insert(hostname, at: 0)
|
||||
}
|
||||
return addrs
|
||||
}
|
||||
|
||||
|
|
8
Podfile
8
Podfile
|
@ -3,10 +3,10 @@ platform :ios, '11.0'
|
|||
use_frameworks!
|
||||
|
||||
def shared_pods
|
||||
pod 'TunnelKit', '~> 1.6.1'
|
||||
pod 'TunnelKit/LZO', '~> 1.6.1'
|
||||
#pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '00502cf'
|
||||
#pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '00502cf'
|
||||
#pod 'TunnelKit', '~> 1.6.1'
|
||||
#pod 'TunnelKit/LZO', '~> 1.6.1'
|
||||
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '914864c'
|
||||
pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '914864c'
|
||||
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
|
||||
#pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit'
|
||||
end
|
||||
|
|
31
Podfile.lock
31
Podfile.lock
|
@ -2,35 +2,44 @@ PODS:
|
|||
- MBProgressHUD (1.1.0)
|
||||
- OpenSSL-Apple (1.1.0i.2)
|
||||
- SwiftyBeaver (1.7.0)
|
||||
- TunnelKit (1.6.1):
|
||||
- TunnelKit/AppExtension (= 1.6.1)
|
||||
- TunnelKit/Core (= 1.6.1)
|
||||
- TunnelKit/AppExtension (1.6.1):
|
||||
- TunnelKit (1.6.2):
|
||||
- TunnelKit/AppExtension (= 1.6.2)
|
||||
- TunnelKit/Core (= 1.6.2)
|
||||
- TunnelKit/AppExtension (1.6.2):
|
||||
- SwiftyBeaver
|
||||
- TunnelKit/Core
|
||||
- TunnelKit/Core (1.6.1):
|
||||
- TunnelKit/Core (1.6.2):
|
||||
- OpenSSL-Apple (~> 1.1.0i.2)
|
||||
- SwiftyBeaver
|
||||
- TunnelKit/LZO (1.6.1)
|
||||
- TunnelKit/LZO (1.6.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- MBProgressHUD
|
||||
- TunnelKit (~> 1.6.1)
|
||||
- TunnelKit/LZO (~> 1.6.1)
|
||||
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `914864c`)
|
||||
- TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `914864c`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- MBProgressHUD
|
||||
- OpenSSL-Apple
|
||||
- SwiftyBeaver
|
||||
- TunnelKit
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
TunnelKit:
|
||||
:commit: 914864c
|
||||
:git: https://github.com/keeshux/tunnelkit
|
||||
|
||||
CHECKOUT OPTIONS:
|
||||
TunnelKit:
|
||||
:commit: 914864c
|
||||
:git: https://github.com/keeshux/tunnelkit
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
|
||||
OpenSSL-Apple: 37a8c0b04df4bb8971deef4671cc29222861319c
|
||||
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
|
||||
TunnelKit: 5dd514cc4565a1701d7474bf811b572886f6f5d0
|
||||
TunnelKit: 6be99150922d3f14187dc29732032712dd4400e3
|
||||
|
||||
PODFILE CHECKSUM: 5e8a25e245bae42e0f054e18e753b0b62126df00
|
||||
PODFILE CHECKSUM: fa38cca58b420f3df9f1b2212ca56a0aa7e4949c
|
||||
|
||||
COCOAPODS: 1.6.1
|
||||
|
|
Loading…
Reference in New Issue