diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-21 15:56:03 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-21 15:56:03 +0100 |
commit | 38445114e00e6d78fe73d03cc69a3a99cd63e9df (patch) | |
tree | 4e7b3d35ca16ff018b921925bf0ac8cebd6ad25e /WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | |
parent | NE: Simplify DNS resolution (diff) | |
download | wireguard-apple-38445114e00e6d78fe73d03cc69a3a99cd63e9df.tar.xz wireguard-apple-38445114e00e6d78fe73d03cc69a3a99cd63e9df.zip |
NE: simplify logic
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift index 888769d..fd706d9 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift @@ -15,15 +15,11 @@ class PacketTunnelSettingsGenerator { self.resolvedEndpoints = resolvedEndpoints } - func endpointUapiConfiguration(shouldIncludeListenPort: Bool, currentListenPort: UInt16?) -> String { + func endpointUapiConfiguration(currentListenPort: UInt16?) -> String { var wgSettings = "" - if shouldIncludeListenPort { - if let tunnelListenPort = tunnelConfiguration.interface.listenPort { - wgSettings.append("listen_port=\(tunnelListenPort)\n") - } else if let currentListenPort = currentListenPort { - wgSettings.append("listen_port=\(currentListenPort)\n") - } + if let currentListenPort = currentListenPort { + wgSettings.append("listen_port=\(tunnelConfiguration.interface.listenPort ?? currentListenPort)\n") } for (index, peer) in tunnelConfiguration.peers.enumerated() { |