diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2024-07-26 14:34:17 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2024-07-26 14:34:17 +0200 |
| commit | 55cfd69fc4bc3292a97e440531fa20e2e09b9e99 (patch) | |
| tree | e3427ca899157c434e5716b052ce8967f39e3070 /ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift | |
| parent | f02965c4903f70f2e1e9d0dfc56203ee7b0accc2 (diff) | |
| parent | 8061e0c0ab5aecba2e80d9b05eed21227982a66d (diff) | |
| download | mullvadvpn-55cfd69fc4bc3292a97e440531fa20e2e09b9e99.tar.xz mullvadvpn-55cfd69fc4bc3292a97e440531fa20e2e09b9e99.zip | |
Merge branch 'negotiate-with-both-peers-when-using-multihop-and-pq-ios-746'
Diffstat (limited to 'ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift')
| -rw-r--r-- | ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift b/ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift index 8028c1ba3e..a854d83cd8 100644 --- a/ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift +++ b/ios/MullvadRustRuntime/PostQuantumKeyExchangeActor.swift @@ -12,7 +12,13 @@ import MullvadTypes import NetworkExtension import WireGuardKitTypes -public class PostQuantumKeyExchangeActor { +public protocol PostQuantumKeyExchangeActorProtocol { + func startNegotiation(with privateKey: PrivateKey) + func endCurrentNegotiation() + func reset() +} + +public class PostQuantumKeyExchangeActor: PostQuantumKeyExchangeActorProtocol { struct Negotiation { var negotiator: PostQuantumKeyNegotiating var inTunnelTCPConnection: NWTCPConnection @@ -69,7 +75,7 @@ public class PostQuantumKeyExchangeActor { endCurrentNegotiation() let negotiator = negotiationProvider.init() - let gatewayAddress = "10.64.0.1" + let gatewayAddress = LocalNetworkIPs.gatewayAddress.rawValue let IPv4Gateway = IPv4Address(gatewayAddress)! let endpoint = NWHostEndpoint(hostname: gatewayAddress, port: "\(CONFIG_SERVICE_PORT)") let inTunnelTCPConnection = createTCPConnection(endpoint) @@ -97,6 +103,8 @@ public class PostQuantumKeyExchangeActor { tcpConnection: inTunnelTCPConnection, postQuantumKeyExchangeTimeout: tcpConnectionTimeout ) { + // Cancel the negotiation to shut down any remaining use of the TCP connection on the Rust side + self.negotiation?.cancel() self.negotiation = nil self.onFailure() } |
