diff options
author | Roopesh Chander <roop@roopc.net> | 2018-10-27 15:02:32 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-10-27 19:07:16 +0530 |
commit | 793bf63989c618c1a116b18144d26b4975c29d29 (patch) | |
tree | 1aea64fb7151a1dd5df6e962d753f5fde95ff374 /WireGuard/Shared | |
parent | Xcode: Make Xcode build libwg-go.a automatically (diff) | |
download | wireguard-apple-793bf63989c618c1a116b18144d26b4975c29d29.tar.xz wireguard-apple-793bf63989c618c1a116b18144d26b4975c29d29.zip |
VPN: Bring up the tunnel
The app figures out all settings and passes them in the
'options' parameter of startTunnel().
The network extension just takes them as is and just plugs the supplied
values into the right places.
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/Shared')
-rw-r--r-- | WireGuard/Shared/PacketTunnelOptionKey.swift | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/WireGuard/Shared/PacketTunnelOptionKey.swift b/WireGuard/Shared/PacketTunnelOptionKey.swift new file mode 100644 index 0000000..7208307 --- /dev/null +++ b/WireGuard/Shared/PacketTunnelOptionKey.swift @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All rights reserved. + +import Foundation + +enum PacketTunnelOptionKey: String { + + case interfaceName, wireguardSettings, remoteAddress, dnsServers, mtu, + + // IPv4 settings + ipv4Addresses, ipv4SubnetMasks, + ipv4IncludedRouteAddresses, ipv4IncludedRouteSubnetMasks, + ipv4ExcludedRouteAddresses, ipv4ExcludedRouteSubnetMasks, + + // IPv6 settings + ipv6Addresses, ipv6NetworkPrefixLengths, + ipv6IncludedRouteAddresses, ipv6IncludedRouteNetworkPrefixLengths, + ipv6ExcludedRouteAddresses, ipv6ExcludedRouteNetworkPrefixLengths +} + +extension Dictionary where Key == String { + subscript(key: PacketTunnelOptionKey) -> Value? { + get { + return self[key.rawValue] + } + set(value) { + self[key.rawValue] = value + } + } +} |