mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-08 09:42:47 +00:00
793bf63989
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>
31 lines
852 B
Swift
31 lines
852 B
Swift
// 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
|
|
}
|
|
}
|
|
}
|