aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 00:28:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 00:28:18 +0100
commit4ed646973ee4e1871cda792083bf4fe70afa8c3f (patch)
tree4f7df25ce19ada60ed792c729e562cb2b367a72b /WireGuard/Shared/Model
parentFix paren typo (diff)
downloadwireguard-apple-4ed646973ee4e1871cda792083bf4fe70afa8c3f.tar.xz
wireguard-apple-4ed646973ee4e1871cda792083bf4fe70afa8c3f.zip
Move name from interface to tunnel
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/Shared/Model')
-rw-r--r--WireGuard/Shared/Model/InterfaceConfiguration.swift6
-rw-r--r--WireGuard/Shared/Model/TunnelConfiguration.swift4
2 files changed, 5 insertions, 5 deletions
diff --git a/WireGuard/Shared/Model/InterfaceConfiguration.swift b/WireGuard/Shared/Model/InterfaceConfiguration.swift
index ff804a6a..ef33907a 100644
--- a/WireGuard/Shared/Model/InterfaceConfiguration.swift
+++ b/WireGuard/Shared/Model/InterfaceConfiguration.swift
@@ -4,18 +4,16 @@
import Foundation
struct InterfaceConfiguration {
- var name: String?
var privateKey: Data
var addresses = [IPAddressRange]()
var listenPort: UInt16?
var mtu: UInt16?
var dns = [DNSServer]()
- init(name: String?, privateKey: Data) {
- self.name = name
- self.privateKey = privateKey
+ init(privateKey: Data) {
if privateKey.count != TunnelConfiguration.keyLength {
fatalError("Invalid private key")
}
+ self.privateKey = privateKey
}
}
diff --git a/WireGuard/Shared/Model/TunnelConfiguration.swift b/WireGuard/Shared/Model/TunnelConfiguration.swift
index 2e394eed..bee3c9dc 100644
--- a/WireGuard/Shared/Model/TunnelConfiguration.swift
+++ b/WireGuard/Shared/Model/TunnelConfiguration.swift
@@ -4,14 +4,16 @@
import Foundation
final class TunnelConfiguration {
+ var name: String?
var interface: InterfaceConfiguration
let peers: [PeerConfiguration]
static let keyLength = 32
- init(interface: InterfaceConfiguration, peers: [PeerConfiguration]) {
+ init(name: String?, interface: InterfaceConfiguration, peers: [PeerConfiguration]) {
self.interface = interface
self.peers = peers
+ self.name = name
let peerPublicKeysArray = peers.map { $0.publicKey }
let peerPublicKeysSet = Set<Data>(peerPublicKeysArray)