From 05d3361e53cd7051605d50d10622290878ab147e Mon Sep 17 00:00:00 2001 From: Mojgan Date: Tue, 14 Nov 2023 10:48:39 +0100 Subject: [PATCH] remove importing namespaces partially --- ios/MullvadREST/RESTAPIProxy.swift | 3 +-- ios/MullvadREST/RESTDevicesProxy.swift | 3 +-- ios/MullvadREST/ServerRelaysResponse.swift | 3 +-- ios/MullvadSettings/DNSSettings.swift | 2 +- ios/MullvadSettings/TunnelSettingsV1.swift | 6 ++---- ios/MullvadTypes/IPv4Endpoint.swift | 2 +- ios/MullvadTypes/IPv6Endpoint.swift | 2 +- ios/MullvadTypes/Location.swift | 2 +- ios/MullvadTypes/MullvadEndpoint.swift | 3 +-- ios/MullvadTypes/RESTTypes.swift | 3 +-- .../SimulatorTunnelProviderHost.swift | 2 +- ios/MullvadVPN/TunnelManager/RotateKeyOperation.swift | 2 +- ios/MullvadVPN/TunnelManager/SetAccountOperation.swift | 3 +-- ios/MullvadVPN/TunnelManager/TunnelManager.swift | 2 +- .../TunnelManager/UpdateDeviceDataOperation.swift | 2 +- ios/MullvadVPN/TunnelManager/WgKeyRotation.swift | 3 +-- ios/MullvadVPNScreenshots/SnapshotHelper.swift | 2 +- ios/MullvadVPNTests/AddressCacheTests.swift | 2 +- ios/MullvadVPNTests/WgKeyRotationTests.swift | 3 +-- ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift | 3 +-- ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteService.swift | 2 +- .../DeviceCheck/DeviceCheckRemoteServiceProtocol.swift | 2 +- ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift | 6 ++---- .../Actor/PacketTunnelActor+ErrorState.swift | 2 +- ios/PacketTunnelCore/Actor/PacketTunnelActor.swift | 2 +- .../Actor/Protocols/TunnelAdapterProtocol.swift | 4 +--- ios/PacketTunnelCore/Actor/State+Extensions.swift | 2 +- ios/PacketTunnelCore/Actor/State.swift | 2 +- ios/PacketTunnelCore/Pinger/Pinger.swift | 4 +--- ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift | 3 +-- ios/PacketTunnelCoreTests/Mocks/RelaySelectorStub.swift | 2 +- ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift | 3 +-- ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift | 3 +-- 33 files changed, 35 insertions(+), 55 deletions(-) diff --git a/ios/MullvadREST/RESTAPIProxy.swift b/ios/MullvadREST/RESTAPIProxy.swift index 70522f8b03e0..8594297410a7 100644 --- a/ios/MullvadREST/RESTAPIProxy.swift +++ b/ios/MullvadREST/RESTAPIProxy.swift @@ -8,8 +8,7 @@ import Foundation import MullvadTypes -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes public protocol APIQuerying { func getAddressList( diff --git a/ios/MullvadREST/RESTDevicesProxy.swift b/ios/MullvadREST/RESTDevicesProxy.swift index 6ec8e299e5a3..7047f3acd404 100644 --- a/ios/MullvadREST/RESTDevicesProxy.swift +++ b/ios/MullvadREST/RESTDevicesProxy.swift @@ -8,8 +8,7 @@ import Foundation import MullvadTypes -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes public protocol DeviceHandling { func getDevice( diff --git a/ios/MullvadREST/ServerRelaysResponse.swift b/ios/MullvadREST/ServerRelaysResponse.swift index 7241d0271f81..63f0822e63b6 100644 --- a/ios/MullvadREST/ServerRelaysResponse.swift +++ b/ios/MullvadREST/ServerRelaysResponse.swift @@ -8,8 +8,7 @@ import Foundation import MullvadTypes -import struct Network.IPv4Address -import struct Network.IPv6Address +import Network extension REST { public struct ServerLocation: Codable, Equatable { diff --git a/ios/MullvadSettings/DNSSettings.swift b/ios/MullvadSettings/DNSSettings.swift index 3885b0150275..4b7a3ae7cb6c 100644 --- a/ios/MullvadSettings/DNSSettings.swift +++ b/ios/MullvadSettings/DNSSettings.swift @@ -8,7 +8,7 @@ import Foundation import MullvadTypes -import struct Network.IPv4Address +import Network /// A struct describing Mullvad DNS blocking options. public struct DNSBlockingOptions: OptionSet, Codable { diff --git a/ios/MullvadSettings/TunnelSettingsV1.swift b/ios/MullvadSettings/TunnelSettingsV1.swift index 1d7301a9108d..21c28164c864 100644 --- a/ios/MullvadSettings/TunnelSettingsV1.swift +++ b/ios/MullvadSettings/TunnelSettingsV1.swift @@ -9,10 +9,8 @@ import Foundation import MullvadREST import MullvadTypes -import struct Network.IPv4Address -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import Network +import WireGuardKitTypes /// A struct that holds the configuration passed via `NETunnelProviderProtocol`. public struct TunnelSettingsV1: Codable, Equatable, TunnelSettings { diff --git a/ios/MullvadTypes/IPv4Endpoint.swift b/ios/MullvadTypes/IPv4Endpoint.swift index 2a6f0ef414bb..c0ed1e477112 100644 --- a/ios/MullvadTypes/IPv4Endpoint.swift +++ b/ios/MullvadTypes/IPv4Endpoint.swift @@ -7,7 +7,7 @@ // import Foundation -import struct Network.IPv4Address +import Network public struct IPv4Endpoint: Hashable, Equatable, Codable, CustomStringConvertible { public let ip: IPv4Address diff --git a/ios/MullvadTypes/IPv6Endpoint.swift b/ios/MullvadTypes/IPv6Endpoint.swift index d6fb323455a9..5dd56a49829c 100644 --- a/ios/MullvadTypes/IPv6Endpoint.swift +++ b/ios/MullvadTypes/IPv6Endpoint.swift @@ -7,7 +7,7 @@ // import Foundation -import struct Network.IPv6Address +import Network public struct IPv6Endpoint: Hashable, Equatable, Codable, CustomStringConvertible { public let ip: IPv6Address diff --git a/ios/MullvadTypes/Location.swift b/ios/MullvadTypes/Location.swift index f324acb410a7..13cf93542558 100644 --- a/ios/MullvadTypes/Location.swift +++ b/ios/MullvadTypes/Location.swift @@ -6,7 +6,7 @@ // Copyright © 2020 Mullvad VPN AB. All rights reserved. // -import struct CoreLocation.CLLocationCoordinate2D +import CoreLocation import Foundation public struct Location: Codable, Equatable { diff --git a/ios/MullvadTypes/MullvadEndpoint.swift b/ios/MullvadTypes/MullvadEndpoint.swift index 82e122a32ffa..9c05111c8cb7 100644 --- a/ios/MullvadTypes/MullvadEndpoint.swift +++ b/ios/MullvadTypes/MullvadEndpoint.swift @@ -7,8 +7,7 @@ // import Foundation -import struct Network.IPv4Address -import struct Network.IPv6Address +import Network /// Contains server data needed to connect to a single mullvad endpoint. public struct MullvadEndpoint: Equatable, Codable { diff --git a/ios/MullvadTypes/RESTTypes.swift b/ios/MullvadTypes/RESTTypes.swift index 68ffcbf68376..bb5c27002216 100644 --- a/ios/MullvadTypes/RESTTypes.swift +++ b/ios/MullvadTypes/RESTTypes.swift @@ -7,8 +7,7 @@ // import Foundation -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes public struct Account: Codable, Equatable { public let id: String diff --git a/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProviderHost.swift b/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProviderHost.swift index eb3e590fbeb1..bac002e436dc 100644 --- a/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProviderHost.swift +++ b/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProviderHost.swift @@ -14,7 +14,7 @@ import MullvadREST import MullvadSettings import MullvadTransport import MullvadTypes -import enum NetworkExtension.NEProviderStopReason +import NetworkExtension import PacketTunnelCore import RelayCache import RelaySelector diff --git a/ios/MullvadVPN/TunnelManager/RotateKeyOperation.swift b/ios/MullvadVPN/TunnelManager/RotateKeyOperation.swift index 46b340ec9d5e..0176f02b39e7 100644 --- a/ios/MullvadVPN/TunnelManager/RotateKeyOperation.swift +++ b/ios/MullvadVPN/TunnelManager/RotateKeyOperation.swift @@ -12,7 +12,7 @@ import MullvadREST import MullvadSettings import MullvadTypes import Operations -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes class RotateKeyOperation: ResultOperation { private let logger = Logger(label: "RotateKeyOperation") diff --git a/ios/MullvadVPN/TunnelManager/SetAccountOperation.swift b/ios/MullvadVPN/TunnelManager/SetAccountOperation.swift index 97a9c6d75bc5..d59beef36886 100644 --- a/ios/MullvadVPN/TunnelManager/SetAccountOperation.swift +++ b/ios/MullvadVPN/TunnelManager/SetAccountOperation.swift @@ -12,8 +12,7 @@ import MullvadREST import MullvadSettings import MullvadTypes import Operations -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes enum SetAccountAction { /// Set new account. diff --git a/ios/MullvadVPN/TunnelManager/TunnelManager.swift b/ios/MullvadVPN/TunnelManager/TunnelManager.swift index 415f7be2eaa1..c49eaed3d24b 100644 --- a/ios/MullvadVPN/TunnelManager/TunnelManager.swift +++ b/ios/MullvadVPN/TunnelManager/TunnelManager.swift @@ -18,7 +18,7 @@ import RelayCache import RelaySelector import StoreKit import UIKit -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /// Interval used for periodic polling of tunnel relay status when tunnel is establishing /// connection. diff --git a/ios/MullvadVPN/TunnelManager/UpdateDeviceDataOperation.swift b/ios/MullvadVPN/TunnelManager/UpdateDeviceDataOperation.swift index 6803dd7d87c4..341af9080653 100644 --- a/ios/MullvadVPN/TunnelManager/UpdateDeviceDataOperation.swift +++ b/ios/MullvadVPN/TunnelManager/UpdateDeviceDataOperation.swift @@ -12,7 +12,7 @@ import MullvadREST import MullvadSettings import MullvadTypes import Operations -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes class UpdateDeviceDataOperation: ResultOperation { private let interactor: TunnelInteractor diff --git a/ios/MullvadVPN/TunnelManager/WgKeyRotation.swift b/ios/MullvadVPN/TunnelManager/WgKeyRotation.swift index 89e6ae68916b..bca8bb0b33a5 100644 --- a/ios/MullvadVPN/TunnelManager/WgKeyRotation.swift +++ b/ios/MullvadVPN/TunnelManager/WgKeyRotation.swift @@ -9,8 +9,7 @@ import Foundation import MullvadSettings import MullvadTypes -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /** Implements manipulations related to marking the beginning and the completion of key rotation, private key creation and other tasks relevant to handling the state of diff --git a/ios/MullvadVPNScreenshots/SnapshotHelper.swift b/ios/MullvadVPNScreenshots/SnapshotHelper.swift index da063ba1c728..0b8a4c53eb24 100644 --- a/ios/MullvadVPNScreenshots/SnapshotHelper.swift +++ b/ios/MullvadVPNScreenshots/SnapshotHelper.swift @@ -200,7 +200,7 @@ open class Snapshot: NSObject { let format = UIGraphicsImageRendererFormat() format.scale = image.scale let renderer = UIGraphicsImageRenderer(size: image.size, format: format) - return renderer.image { context in + return renderer.image { _ in image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) } } else { diff --git a/ios/MullvadVPNTests/AddressCacheTests.swift b/ios/MullvadVPNTests/AddressCacheTests.swift index a42aa3b8dde3..0a7843551fdb 100644 --- a/ios/MullvadVPNTests/AddressCacheTests.swift +++ b/ios/MullvadVPNTests/AddressCacheTests.swift @@ -8,7 +8,7 @@ @testable import MullvadREST import MullvadTypes -import struct Network.IPv4Address +import Network import XCTest final class AddressCacheTests: XCTestCase { diff --git a/ios/MullvadVPNTests/WgKeyRotationTests.swift b/ios/MullvadVPNTests/WgKeyRotationTests.swift index 764886f3724d..2be36c6fddb6 100644 --- a/ios/MullvadVPNTests/WgKeyRotationTests.swift +++ b/ios/MullvadVPNTests/WgKeyRotationTests.swift @@ -8,8 +8,7 @@ import MullvadSettings import MullvadTypes -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes import XCTest final class WgKeyRotationTests: XCTestCase { diff --git a/ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift b/ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift index ce6913b5cc17..f3270c8a8d26 100644 --- a/ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift +++ b/ios/PacketTunnel/DeviceCheck/DeviceCheckOperation.swift @@ -13,8 +13,7 @@ import MullvadSettings import MullvadTypes import Operations import PacketTunnelCore -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /** An operation that is responsible for performing account and device diagnostics and key rotation from within packet diff --git a/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteService.swift b/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteService.swift index bbefc302158a..2bae95fe3c4b 100644 --- a/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteService.swift +++ b/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteService.swift @@ -9,7 +9,7 @@ import Foundation import MullvadREST import MullvadTypes -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /// An object that implements remote service used by `DeviceCheckOperation`. struct DeviceCheckRemoteService: DeviceCheckRemoteServiceProtocol { diff --git a/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteServiceProtocol.swift b/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteServiceProtocol.swift index faf22e368053..0cab26654f87 100644 --- a/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteServiceProtocol.swift +++ b/ios/PacketTunnel/DeviceCheck/DeviceCheckRemoteServiceProtocol.swift @@ -8,7 +8,7 @@ import Foundation import MullvadTypes -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /// A protocol that formalizes remote service dependency used by `DeviceCheckOperation`. protocol DeviceCheckRemoteServiceProtocol { diff --git a/ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift b/ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift index 6ba03db89b3e..1b06f39366bf 100644 --- a/ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift +++ b/ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift @@ -8,10 +8,8 @@ import Foundation import MullvadTypes -import protocol Network.IPAddress -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import Network +import WireGuardKitTypes /// Error returned when there is an endpoint but its public key is invalid. public struct PublicKeyError: LocalizedError { diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift index b95e0c8d5e7e..71afd7cdfd44 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift @@ -7,7 +7,7 @@ // import Foundation -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes extension PacketTunnelActor { /** diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift index 6f72ef90859e..9e3598db656c 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift @@ -10,7 +10,7 @@ import Foundation import MullvadLogging import MullvadTypes import NetworkExtension -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes /** Packet tunnel state machine implemented as an actor. diff --git a/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift b/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift index c4c499f83e60..b50ab4a7ada0 100644 --- a/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift +++ b/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift @@ -10,9 +10,7 @@ import Foundation import MullvadTypes import Network -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey -import class WireGuardKitTypes.PublicKey +import WireGuardKitTypes /// Protocol describing interface for any kind of adapter implementing a VPN tunnel. public protocol TunnelAdapterProtocol { diff --git a/ios/PacketTunnelCore/Actor/State+Extensions.swift b/ios/PacketTunnelCore/Actor/State+Extensions.swift index 402938da8f78..dc7580fdf158 100644 --- a/ios/PacketTunnelCore/Actor/State+Extensions.swift +++ b/ios/PacketTunnelCore/Actor/State+Extensions.swift @@ -8,7 +8,7 @@ import Foundation import MullvadTypes -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes extension State { /// Returns the target state to which the actor state should transition when requested to reconnect. diff --git a/ios/PacketTunnelCore/Actor/State.swift b/ios/PacketTunnelCore/Actor/State.swift index 0ae7b22de1d4..03149081374d 100644 --- a/ios/PacketTunnelCore/Actor/State.swift +++ b/ios/PacketTunnelCore/Actor/State.swift @@ -9,7 +9,7 @@ import Foundation import MullvadTypes import TunnelObfuscation -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes /** Tunnel actor state with metadata describing the current phase of packet tunnel lifecycle. diff --git a/ios/PacketTunnelCore/Pinger/Pinger.swift b/ios/PacketTunnelCore/Pinger/Pinger.swift index f5a0cee0b512..1cc9ccea41e0 100644 --- a/ios/PacketTunnelCore/Pinger/Pinger.swift +++ b/ios/PacketTunnelCore/Pinger/Pinger.swift @@ -7,9 +7,7 @@ // import Foundation -import protocol Network.IPAddress -import struct Network.IPv4Address -import struct Network.IPv6Address +import Network /// ICMP client. public final class Pinger: PingerProtocol { diff --git a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift index 195a8acde882..16ab1d06989b 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift @@ -9,8 +9,7 @@ import Foundation import MullvadLogging import MullvadTypes -import protocol Network.IPAddress -import struct Network.IPv4Address +import Network /// Tunnel monitor. public final class TunnelMonitor: TunnelMonitorProtocol { diff --git a/ios/PacketTunnelCoreTests/Mocks/RelaySelectorStub.swift b/ios/PacketTunnelCoreTests/Mocks/RelaySelectorStub.swift index 8c69404bdcb5..c601c860d4e7 100644 --- a/ios/PacketTunnelCoreTests/Mocks/RelaySelectorStub.swift +++ b/ios/PacketTunnelCoreTests/Mocks/RelaySelectorStub.swift @@ -9,7 +9,7 @@ import Foundation import MullvadTypes import PacketTunnelCore -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes /// Relay selector stub that accepts a block that can be used to provide custom implementation. struct RelaySelectorStub: RelaySelectorProtocol { diff --git a/ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift b/ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift index 7679b11ac84f..1893f4363d31 100644 --- a/ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift +++ b/ios/PacketTunnelCoreTests/Mocks/SettingsReaderStub.swift @@ -9,8 +9,7 @@ import Foundation import MullvadTypes import PacketTunnelCore -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes /// Settings reader stub that can be configured with a block to provide the desired behavior when testing. struct SettingsReaderStub: SettingsReaderProtocol { diff --git a/ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift b/ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift index 34a6fe34787d..50145b3935df 100644 --- a/ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift +++ b/ios/PacketTunnelCoreTests/PacketTunnelActorTests.swift @@ -12,8 +12,7 @@ import MullvadTypes import Network @testable import PacketTunnelCore @testable import RelaySelector -import struct WireGuardKitTypes.IPAddressRange -import class WireGuardKitTypes.PrivateKey +import WireGuardKitTypes import XCTest final class PacketTunnelActorTests: XCTestCase {