summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPNTests/MullvadVPN/GeneralAPIs/OutgoingConnectionProxy+Stub.swift
blob: 1c3115e0ec3c3601641f3b68b02836aa77e1fd32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
//  File.swift
//  MullvadVPNTests
//
//  Created by Mojgan on 2023-10-25.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import MullvadREST

struct OutgoingConnectionProxyStub: OutgoingConnectionHandling {
    var ipV4: IPV4ConnectionData
    var ipV6: IPV6ConnectionData
    var error: Error?

    func getIPV6(retryStrategy: MullvadREST.REST.RetryStrategy) async throws -> IPV6ConnectionData {
        if let error {
            throw error
        } else {
            return ipV6
        }
    }

    func getIPV4(retryStrategy: MullvadREST.REST.RetryStrategy) async throws -> IPV4ConnectionData {
        if let error {
            throw error
        } else {
            return ipV4
        }
    }
}

extension IPV4ConnectionData {
    static let mock = IPV4ConnectionData(ip: .loopback, exitIP: true)
}

extension IPV6ConnectionData {
    static let mock = IPV6ConnectionData(ip: .loopback, exitIP: true)
}