Use MTU configuration for the link instead
Raise default link MTU from 1000 to 1250. Keep default for tunnel MTU.
This commit is contained in:
parent
6208fe8e21
commit
54cc811e47
|
@ -125,8 +125,8 @@ extension TunnelKitProvider {
|
||||||
/// The optional CA certificate to validate server against. Set to `nil` to disable CA validation (default).
|
/// The optional CA certificate to validate server against. Set to `nil` to disable CA validation (default).
|
||||||
public var ca: Certificate?
|
public var ca: Certificate?
|
||||||
|
|
||||||
/// The MTU of the tunnel.
|
/// The MTU of the link.
|
||||||
public var mtu: NSNumber
|
public var mtu: Int
|
||||||
|
|
||||||
/// Enables LZO framing (deprecated).
|
/// Enables LZO framing (deprecated).
|
||||||
// @available(*, deprecated)
|
// @available(*, deprecated)
|
||||||
|
@ -214,7 +214,7 @@ extension TunnelKitProvider {
|
||||||
self.cipher = cipher
|
self.cipher = cipher
|
||||||
self.digest = digest
|
self.digest = digest
|
||||||
self.ca = ca
|
self.ca = ca
|
||||||
mtu = providerConfiguration[S.mtu] as? NSNumber ?? 1500
|
mtu = providerConfiguration[S.mtu] as? Int ?? 1250
|
||||||
LZOFraming = providerConfiguration[S.LZOFraming] as? Bool ?? false
|
LZOFraming = providerConfiguration[S.LZOFraming] as? Bool ?? false
|
||||||
renegotiatesAfterSeconds = providerConfiguration[S.renegotiatesAfter] as? Int
|
renegotiatesAfterSeconds = providerConfiguration[S.renegotiatesAfter] as? Int
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ extension TunnelKitProvider {
|
||||||
public let ca: Certificate?
|
public let ca: Certificate?
|
||||||
|
|
||||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu`
|
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu`
|
||||||
public let mtu: NSNumber
|
public let mtu: Int
|
||||||
|
|
||||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.LZOFraming`
|
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.LZOFraming`
|
||||||
public let LZOFraming: Bool
|
public let LZOFraming: Bool
|
||||||
|
|
|
@ -335,10 +335,10 @@ extension TunnelKitProvider: GenericSocketDelegate {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if proxy.canRebindLink() {
|
if proxy.canRebindLink() {
|
||||||
proxy.rebindLink(socket.link(withMTU: 1000))
|
proxy.rebindLink(socket.link(withMTU: cfg.mtu))
|
||||||
reasserting = false
|
reasserting = false
|
||||||
} else {
|
} else {
|
||||||
proxy.setLink(socket.link(withMTU: 1000))
|
proxy.setLink(socket.link(withMTU: cfg.mtu))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,6 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: tunnel)
|
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: tunnel)
|
||||||
newSettings.ipv4Settings = ipv4Settings
|
newSettings.ipv4Settings = ipv4Settings
|
||||||
newSettings.dnsSettings = dnsSettings
|
newSettings.dnsSettings = dnsSettings
|
||||||
newSettings.mtu = cfg.mtu
|
|
||||||
|
|
||||||
setTunnelNetworkSettings(newSettings, completionHandler: completionHandler)
|
setTunnelNetworkSettings(newSettings, completionHandler: completionHandler)
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class AppExtensionTests: XCTestCase {
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.cipherAlgorithm] as? String, cfg.cipher.rawValue)
|
XCTAssertEqual(proto?.providerConfiguration?[K.cipherAlgorithm] as? String, cfg.cipher.rawValue)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.digestAlgorithm] as? String, cfg.digest.rawValue)
|
XCTAssertEqual(proto?.providerConfiguration?[K.digestAlgorithm] as? String, cfg.digest.rawValue)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.ca] as? String, cfg.ca?.pem)
|
XCTAssertEqual(proto?.providerConfiguration?[K.ca] as? String, cfg.ca?.pem)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.mtu] as? NSNumber, cfg.mtu)
|
XCTAssertEqual(proto?.providerConfiguration?[K.mtu] as? Int, cfg.mtu)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.renegotiatesAfter] as? Int, cfg.renegotiatesAfterSeconds)
|
XCTAssertEqual(proto?.providerConfiguration?[K.renegotiatesAfter] as? Int, cfg.renegotiatesAfterSeconds)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.debug] as? Bool, cfg.shouldDebug)
|
XCTAssertEqual(proto?.providerConfiguration?[K.debug] as? Bool, cfg.shouldDebug)
|
||||||
XCTAssertEqual(proto?.providerConfiguration?[K.debugLogKey] as? String, cfg.debugLogKey)
|
XCTAssertEqual(proto?.providerConfiguration?[K.debugLogKey] as? String, cfg.debugLogKey)
|
||||||
|
|
Loading…
Reference in New Issue