summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadMockData/MullvadREST/ServerRelaysResponse+Stubs.swift
blob: c6fde137fbdfde34f7059aa12bdf13fd9ef24fb8 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//
//  ServerRelaysResponse+Stubs.swift
//  MullvadVPNTests
//
//  Created by Marco Nikic on 2023-10-03.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import WireGuardKitTypes

@testable import MullvadREST

public enum ServerRelaysResponseStubs {
    public static let wireguardPortRanges: [[UInt16]] = [[4000, 4001], [5000, 5001]]
    public static let shadowsocksPortRanges: [[UInt16]] = [[51900, 51949]]

    public static let sampleRelays = REST.ServerRelaysResponse(
        locations: [
            "es-mad": REST.ServerLocation(
                country: "Spain",
                city: "Madrid",
                latitude: 40.408566,
                longitude: -3.69222
            ),
            "se-got": REST.ServerLocation(
                country: "Sweden",
                city: "Gothenburg",
                latitude: 57.70887,
                longitude: 11.97456
            ),
            "se-sto": REST.ServerLocation(
                country: "Sweden",
                city: "Stockholm",
                latitude: 59.3289,
                longitude: 18.0649
            ),
            "ae-dxb": REST.ServerLocation(
                country: "United Arab Emirates",
                city: "Dubai",
                latitude: 25.276987,
                longitude: 55.296249
            ),
            "jp-tyo": REST.ServerLocation(
                country: "Japan",
                city: "Tokyo",
                latitude: 35.685,
                longitude: 139.751389
            ),
            "ca-tor": REST.ServerLocation(
                country: "Canada",
                city: "Toronto",
                latitude: 43.666667,
                longitude: -79.416667
            ),
            "us-atl": REST.ServerLocation(
                country: "USA",
                city: "Atlanta, GA",
                latitude: 40.73061,
                longitude: -73.935242
            ),
            "us-dal": REST.ServerLocation(
                country: "USA",
                city: "Dallas, TX",
                latitude: 32.89748,
                longitude: -97.040443
            ),
            "us-nyc": REST.ServerLocation(
                country: "USA",
                city: "New York, NY",
                latitude: 40.6963302,
                longitude: -74.6034843
            ),
        ],
        wireguard: REST.ServerWireguardTunnels(
            ipv4Gateway: .loopback,
            ipv6Gateway: .loopback,
            portRanges: wireguardPortRanges,
            relays: [
                REST.ServerRelay(
                    hostname: "es1-wireguard",
                    active: true,
                    owned: false,
                    location: "es-mad",
                    provider: "100TB",
                    weight: 500,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: true,
                    shadowsocksExtraAddrIn: ["0.0.0.0"],
                    features: .init(daita: .init(), quic: nil)
                ),
                REST.ServerRelay(
                    hostname: "se10-wireguard",
                    active: true,
                    owned: true,
                    location: "se-got",
                    provider: "Blix",
                    weight: 1000,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: false,
                    shadowsocksExtraAddrIn: ["0.0.0.0"],
                    features: .init(
                        daita: nil,
                        quic: .init(addrIn: ["0.0.0.0"], domain: "quic.domain", token: "")
                    )
                ),
                REST.ServerRelay(
                    hostname: "se2-wireguard",
                    active: true,
                    owned: true,
                    location: "se-sto",
                    provider: "DataPacket",
                    weight: 50,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: false,
                    shadowsocksExtraAddrIn: ["0.0.0.0"],
                    features: nil
                ),
                REST.ServerRelay(
                    hostname: "se6-wireguard",
                    active: true,
                    owned: true,
                    location: "se-sto",
                    provider: "31173",
                    weight: 100,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: false,
                    shadowsocksExtraAddrIn: ["0.0.0.0"],
                    features: nil
                ),
                REST.ServerRelay(
                    hostname: "us-dal-wg-001",
                    active: true,
                    owned: true,
                    location: "us-dal",
                    provider: "M247",
                    weight: 100,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: true,
                    shadowsocksExtraAddrIn: ["0.0.0.0"],
                    features: nil
                ),
                REST.ServerRelay(
                    hostname: "us-nyc-wg-301",
                    active: true,
                    owned: false,
                    location: "us-nyc",
                    provider: "xtom",
                    weight: 100,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: true,
                    shadowsocksExtraAddrIn: nil,
                    features: .init(daita: .init(), quic: nil)
                ),
                REST.ServerRelay(
                    hostname: "us-nyc-wg-302",
                    active: false,
                    owned: true,
                    location: "us-nyc",
                    provider: "Qnax",
                    weight: 100,
                    ipv4AddrIn: .loopback,
                    ipv6AddrIn: .loopback,
                    publicKey: PrivateKey().publicKey.rawValue,
                    includeInCountry: true,
                    daita: true,
                    shadowsocksExtraAddrIn: nil,
                    features: .init(daita: .init(), quic: nil)
                ),
            ],
            shadowsocksPortRanges: shadowsocksPortRanges
        ),
        bridge: REST.ServerBridges(
            shadowsocks: [
                REST.ServerShadowsocks(protocol: "tcp", port: 443, cipher: "aes-256-gcm", password: "mullvad")
            ],
            relays: [
                REST.BridgeRelay(
                    hostname: "se-sto-br-001",
                    active: true,
                    owned: true,
                    location: "se-sto",
                    provider: "31173",
                    ipv4AddrIn: .loopback,
                    weight: 100,
                    includeInCountry: true
                ),
                REST.BridgeRelay(
                    hostname: "jp-tyo-br-101",
                    active: true,
                    owned: true,
                    location: "jp-tyo",
                    provider: "M247",
                    ipv4AddrIn: .loopback,
                    weight: 1,
                    includeInCountry: true
                ),
                REST.BridgeRelay(
                    hostname: "ca-tor-ovpn-001",
                    active: false,
                    owned: false,
                    location: "ca-tor",
                    provider: "M247",
                    ipv4AddrIn: .loopback,
                    weight: 1,
                    includeInCountry: true
                ),
                REST.BridgeRelay(
                    hostname: "ae-dxb-ovpn-001",
                    active: true,
                    owned: false,
                    location: "ae-dxb",
                    provider: "M247",
                    ipv4AddrIn: .loopback,
                    weight: 100,
                    includeInCountry: true
                ),
                REST.BridgeRelay(
                    hostname: "us-atl-br-101",
                    active: true,
                    owned: false,
                    location: "us-atl",
                    provider: "100TB",
                    ipv4AddrIn: .loopback,
                    weight: 100,
                    includeInCountry: true
                ),
                REST.BridgeRelay(
                    hostname: "us-dal-br-101",
                    active: true,
                    owned: false,
                    location: "us-dal",
                    provider: "100TB",
                    ipv4AddrIn: .loopback,
                    weight: 100,
                    includeInCountry: true
                ),
            ])
    )
}