Skip to content

Commit

Permalink
Merge TunnelProviderMessaging into PacketTunnelCore
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej Mihajlov committed Sep 20, 2023
1 parent 455de91 commit 02787f4
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 218 deletions.
259 changes: 68 additions & 191 deletions ios/MullvadVPN.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import MullvadSettings
import MullvadTransport
import MullvadTypes
import enum NetworkExtension.NEProviderStopReason
import PacketTunnelCore
import RelayCache
import RelaySelector
import TunnelProviderMessaging

final class SimulatorTunnelProviderHost: SimulatorTunnelProviderDelegate {
private var selectorResult: RelaySelectorResult?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MullvadREST
import MullvadTransport
import MullvadTypes
import Operations
import TunnelProviderMessaging
import PacketTunnelCore

struct PacketTunnelTransport: RESTTransport {
var name: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import MullvadREST
import MullvadTypes
import NetworkExtension
import Operations
import TunnelProviderMessaging
import PacketTunnelCore

class MapConnectionStatusOperation: AsyncOperation {
private let interactor: TunnelInteractor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import MullvadTypes
import NetworkExtension
import Operations
import TunnelProviderMessaging
import PacketTunnelCore
import UIKit

/// Delay for sending tunnel provider messages to the tunnel when in connecting state.
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/StartTunnelOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Foundation
import MullvadLogging
import NetworkExtension
import Operations
import PacketTunnelCore
import RelayCache
import RelaySelector
import TunnelProviderMessaging

class StartTunnelOperation: ResultOperation<Void> {
typealias EncodeErrorHandler = (Error) -> Void
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/Tunnel+Messaging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation
import MullvadREST
import MullvadTypes
import Operations
import PacketTunnelCore
import RelaySelector
import TunnelProviderMessaging

/// Shared operation queue used for IPC requests.
private let operationQueue = AsyncOperationQueue()
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/TunnelManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import MullvadSettings
import MullvadTypes
import NetworkExtension
import Operations
import PacketTunnelCore
import RelayCache
import RelaySelector
import StoreKit
import TunnelProviderMessaging
import UIKit
import class WireGuardKitTypes.PublicKey

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/TunnelState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import MullvadTypes
import TunnelProviderMessaging
import PacketTunnelCore

/// A struct describing the tunnel status.
struct TunnelStatus: Equatable, CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import MapKit
import MullvadLogging
import MullvadTypes
import TunnelProviderMessaging
import UIKit

class TunnelViewController: UIViewController, RootContainment {
Expand Down
1 change: 1 addition & 0 deletions ios/MullvadVPNTests/DeviceCheckOperationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import MullvadREST
import MullvadSettings
import MullvadTypes
import Operations
import PacketTunnelCore
import WireGuardKitTypes
import XCTest

Expand Down
1 change: 1 addition & 0 deletions ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MullvadREST
import MullvadSettings
import MullvadTypes
import Operations
import PacketTunnelCore
import class WireGuardKitTypes.PrivateKey
import class WireGuardKitTypes.PublicKey

Expand Down
1 change: 0 additions & 1 deletion ios/PacketTunnel/PacketTunnelProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Operations
import PacketTunnelCore
import RelayCache
import RelaySelector
import TunnelProviderMessaging
import WireGuardKit

/// Restart interval (in seconds) for the tunnel that failed to start early on.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PacketTunnelOptions.swift
// TunnelProviderMessaging
// PacketTunnelCore
//
// Created by pronebird on 22/08/2021.
// Copyright © 2021 Mullvad VPN AB. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//
// PacketTunnelRelay.swift
// MullvadTypes
// PacketTunnelCore
//
// Created by pronebird on 21/10/2022.
// Copyright © 2022 Mullvad VPN AB. All rights reserved.
//

import Foundation
import MullvadTypes

/// Struct holding tunnel relay information.
public struct PacketTunnelRelay: Codable, Equatable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//
// PacketTunnelStatus.swift
// MullvadTypes
// PacketTunnelCore
//
// Created by pronebird on 27/07/2021.
// Copyright © 2021 Mullvad VPN AB. All rights reserved.
//

import Foundation
import MullvadTypes

/// The verdict of an account status check.
public enum AccountVerdict: Equatable, Codable {
Expand Down
21 changes: 21 additions & 0 deletions ios/PacketTunnelCore/IPC/RelaySelectorResult+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// RelaySelectorResult+.swift
// PacketTunnelCore
//
// Created by pronebird on 20/09/2023.
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

import Foundation
import RelaySelector

extension RelaySelectorResult {
public var packetTunnelRelay: PacketTunnelRelay {
PacketTunnelRelay(
ipv4Relay: endpoint.ipv4Relay,
ipv6Relay: endpoint.ipv6Relay,
hostname: relay.hostname,
location: location
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// TunnelProviderMessage.swift
// TunnelProviderMessaging
// PacketTunnelCore
//
// Created by pronebird on 27/07/2021.
// Copyright © 2021 Mullvad VPN AB. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// TunnelProviderReply.swift
// TunnelProviderMessaging
// PacketTunnelCore
//
// Created by pronebird on 20/10/2022.
// Copyright © 2022 Mullvad VPN AB. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ProxyURLRequest.swift
// TunnelProviderMessaging
// PacketTunnelCore
//
// Created by Sajad Vishkai on 2022-10-03.
// Copyright © 2022 Mullvad VPN AB. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ProxyURLResponse.swift
// TunnelProviderMessaging
// PacketTunnelCore
//
// Created by pronebird on 20/10/2022.
// Copyright © 2022 Mullvad VPN AB. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// URLRequestProxy.swift
// PacketTunnel
// PacketTunnelCore
//
// Created by pronebird on 03/02/2023.
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
Expand Down
9 changes: 0 additions & 9 deletions ios/RelaySelector/RelaySelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,6 @@ public struct RelaySelectorResult: Codable {
public var endpoint: MullvadEndpoint
public var relay: REST.ServerRelay
public var location: Location

public var packetTunnelRelay: PacketTunnelRelay {
PacketTunnelRelay(
ipv4Relay: endpoint.ipv4Relay,
ipv6Relay: endpoint.ipv6Relay,
hostname: relay.hostname,
location: location
)
}
}

protocol AnyRelay {
Expand Down

0 comments on commit 02787f4

Please sign in to comment.