Use builders for editing configurations
Slip-ups in TunnelKit made configurations erroneously mutable.
This commit is contained in:
parent
610d3f4344
commit
bab8e28b04
|
@ -352,7 +352,9 @@ public class ConnectionService: Codable {
|
||||||
|
|
||||||
// fall back to the safer option
|
// fall back to the safer option
|
||||||
var builder = host.parameters.builder()
|
var builder = host.parameters.builder()
|
||||||
builder.sessionConfiguration.routingPolicies = [.IPv4, .IPv6]
|
var sessionBuilder = builder.sessionConfiguration.builder()
|
||||||
|
sessionBuilder.routingPolicies = [.IPv4, .IPv6]
|
||||||
|
builder.sessionConfiguration = sessionBuilder.build()
|
||||||
host.parameters = builder.build()
|
host.parameters = builder.build()
|
||||||
}
|
}
|
||||||
cache[entry.key] = host
|
cache[entry.key] = host
|
||||||
|
|
|
@ -67,7 +67,9 @@ public class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
builder.masksPrivateData = configuration.masksPrivateData
|
builder.masksPrivateData = configuration.masksPrivateData
|
||||||
|
|
||||||
// forcibly override hostname with profile hostname (never nil)
|
// forcibly override hostname with profile hostname (never nil)
|
||||||
builder.sessionConfiguration.hostname = hostname
|
var sessionBuilder = builder.sessionConfiguration.builder()
|
||||||
|
sessionBuilder.hostname = hostname
|
||||||
|
builder.sessionConfiguration = sessionBuilder.build()
|
||||||
|
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,9 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
builder.resolvedAddresses = pool.addresses()
|
builder.resolvedAddresses = pool.addresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sessionBuilder = builder.sessionConfiguration.builder()
|
||||||
if let proto = manualProtocol {
|
if let proto = manualProtocol {
|
||||||
builder.sessionConfiguration.endpointProtocols = [proto]
|
sessionBuilder.endpointProtocols = [proto]
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// restrict "Any" protocol to UDP, unless there are no UDP endpoints
|
// restrict "Any" protocol to UDP, unless there are no UDP endpoints
|
||||||
|
@ -145,12 +146,14 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
endpoints = allEndpoints
|
endpoints = allEndpoints
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.sessionConfiguration.endpointProtocols = endpoints
|
sessionBuilder.endpointProtocols = endpoints
|
||||||
// builder.sessionConfiguration.endpointProtocols = [
|
// sessionBuilder.endpointProtocols = [
|
||||||
// EndpointProtocol(.udp, 8080),
|
// EndpointProtocol(.udp, 8080),
|
||||||
// EndpointProtocol(.tcp, 443)
|
// EndpointProtocol(.tcp, 443)
|
||||||
// ]
|
// ]
|
||||||
}
|
}
|
||||||
|
builder.sessionConfiguration = sessionBuilder.build()
|
||||||
|
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
Podfile
8
Podfile
|
@ -3,10 +3,10 @@ platform :ios, '11.0'
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
|
||||||
def shared_pods
|
def shared_pods
|
||||||
pod 'TunnelKit', '~> 1.7.0'
|
#pod 'TunnelKit', '~> 1.7.0'
|
||||||
pod 'TunnelKit/LZO', '~> 1.7.0'
|
#pod 'TunnelKit/LZO', '~> 1.7.0'
|
||||||
#pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => 'f799f47'
|
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '4da64c5'
|
||||||
#pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => 'f799f47'
|
pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '4da64c5'
|
||||||
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
|
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
|
||||||
#pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit'
|
#pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit'
|
||||||
pod 'SSZipArchive'
|
pod 'SSZipArchive'
|
||||||
|
|
31
Podfile.lock
31
Podfile.lock
|
@ -3,22 +3,22 @@ PODS:
|
||||||
- OpenSSL-Apple (1.1.0j.2)
|
- OpenSSL-Apple (1.1.0j.2)
|
||||||
- SSZipArchive (2.1.4)
|
- SSZipArchive (2.1.4)
|
||||||
- SwiftyBeaver (1.7.0)
|
- SwiftyBeaver (1.7.0)
|
||||||
- TunnelKit (1.7.0):
|
- TunnelKit (1.7.1):
|
||||||
- TunnelKit/AppExtension (= 1.7.0)
|
- TunnelKit/AppExtension (= 1.7.1)
|
||||||
- TunnelKit/Core (= 1.7.0)
|
- TunnelKit/Core (= 1.7.1)
|
||||||
- TunnelKit/AppExtension (1.7.0):
|
- TunnelKit/AppExtension (1.7.1):
|
||||||
- SwiftyBeaver
|
- SwiftyBeaver
|
||||||
- TunnelKit/Core
|
- TunnelKit/Core
|
||||||
- TunnelKit/Core (1.7.0):
|
- TunnelKit/Core (1.7.1):
|
||||||
- OpenSSL-Apple (~> 1.1.0j.2)
|
- OpenSSL-Apple (~> 1.1.0j.2)
|
||||||
- SwiftyBeaver
|
- SwiftyBeaver
|
||||||
- TunnelKit/LZO (1.7.0)
|
- TunnelKit/LZO (1.7.1)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- MBProgressHUD
|
- MBProgressHUD
|
||||||
- SSZipArchive
|
- SSZipArchive
|
||||||
- TunnelKit (~> 1.7.0)
|
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `4da64c5`)
|
||||||
- TunnelKit/LZO (~> 1.7.0)
|
- TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `4da64c5`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
https://github.com/cocoapods/specs.git:
|
https://github.com/cocoapods/specs.git:
|
||||||
|
@ -26,15 +26,24 @@ SPEC REPOS:
|
||||||
- OpenSSL-Apple
|
- OpenSSL-Apple
|
||||||
- SSZipArchive
|
- SSZipArchive
|
||||||
- SwiftyBeaver
|
- SwiftyBeaver
|
||||||
- TunnelKit
|
|
||||||
|
EXTERNAL SOURCES:
|
||||||
|
TunnelKit:
|
||||||
|
:commit: 4da64c5
|
||||||
|
:git: https://github.com/keeshux/tunnelkit
|
||||||
|
|
||||||
|
CHECKOUT OPTIONS:
|
||||||
|
TunnelKit:
|
||||||
|
:commit: 4da64c5
|
||||||
|
:git: https://github.com/keeshux/tunnelkit
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
|
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
|
||||||
OpenSSL-Apple: e88e1eb314acb4a05e2348069790c4aa49f6d319
|
OpenSSL-Apple: e88e1eb314acb4a05e2348069790c4aa49f6d319
|
||||||
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
|
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
|
||||||
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
|
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
|
||||||
TunnelKit: 7355382cd0ff4fce26e48c51dc680d0497b35b17
|
TunnelKit: dd00b33e4c6d84f2d32390448a33ef5e37b1ac52
|
||||||
|
|
||||||
PODFILE CHECKSUM: 5c6c177586b156662aaed2bc5953ab15560cb112
|
PODFILE CHECKSUM: 32c9f11727e184e6ffbbdf5bd88ea65f79f1f155
|
||||||
|
|
||||||
COCOAPODS: 1.6.1
|
COCOAPODS: 1.6.1
|
||||||
|
|
Loading…
Reference in New Issue