aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-16 01:51:14 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-16 01:51:14 +0100
commit727992f5d2b2008cb815ce4f6626c9c779523582 (patch)
tree787c93cd82f208d00cc86e8ba5822a13138c8a26 /WireGuard
parentProvide mock tunnels for the Simulator (diff)
downloadwireguard-apple-727992f5d2b2008cb815ce4f6626c9c779523582.tar.xz
wireguard-apple-727992f5d2b2008cb815ce4f6626c9c779523582.zip
Improve mock tunnels generation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/Tunnel/MockTunnels.swift15
1 files changed, 10 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/Tunnel/MockTunnels.swift b/WireGuard/WireGuard/Tunnel/MockTunnels.swift
index 116a1d8..764d860 100644
--- a/WireGuard/WireGuard/Tunnel/MockTunnels.swift
+++ b/WireGuard/WireGuard/Tunnel/MockTunnels.swift
@@ -11,18 +11,23 @@ class MockTunnels {
"demo",
"edgesecurity",
"home",
- "office"
+ "office",
+ "infra-fr",
+ "infra-us",
+ "krantz",
+ "metheny",
+ "frisell"
]
- static let address = "192.168.4.184/24"
- static let dnsServers = ["8.8.8.8", "4.4.4.4"]
- static let endpoint = "demo.wireguard.com:12912"
+ static let address = "192.168.%d.%d/32"
+ static let dnsServers = ["8.8.8.8", "8.8.4.4"]
+ static let endpoint = "demo.wireguard.com:51820"
static let allowedIPs = "0.0.0.0/0"
static func createMockTunnels() -> [NETunnelProviderManager] {
return tunnelNames.map { tunnelName -> NETunnelProviderManager in
var interface = InterfaceConfiguration(name: tunnelName, privateKey: Curve25519.generatePrivateKey())
- interface.addresses = [IPAddressRange(from: address)!]
+ interface.addresses = [IPAddressRange(from: String(format: address, Int.random(in: 1 ... 10), Int.random(in: 1 ... 254)))!]
interface.dns = dnsServers.map { DNSServer(from: $0)! }
var peer = PeerConfiguration(publicKey: Curve25519.generatePublicKey(fromPrivateKey: Curve25519.generatePrivateKey()))