aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Model/Configuration.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-13 17:44:46 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-27 15:13:01 +0530
commit3630543be5af3bb82329604561c41548ae889337 (patch)
tree73bdd85c11792f1852eeb111d0be8493e3bf27c2 /WireGuard/WireGuard/Model/Configuration.swift
parentConfigure the split-view controller to work in both iPhone and iPad (diff)
downloadwireguard-apple-3630543be5af3bb82329604561c41548ae889337.tar.xz
wireguard-apple-3630543be5af3bb82329604561c41548ae889337.zip
Models for tunnel, interface and peer
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/Model/Configuration.swift41
1 files changed, 41 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Model/Configuration.swift b/WireGuard/WireGuard/Model/Configuration.swift
new file mode 100644
index 0000000..0854acb
--- /dev/null
+++ b/WireGuard/WireGuard/Model/Configuration.swift
@@ -0,0 +1,41 @@
+//
+// TunnelConfiguration.swift
+// WireGuard
+//
+// Created by Roopesh Chander on 13/10/18.
+// Copyright © 2018 WireGuard LLC. All rights reserved.
+//
+
+import Foundation
+
+class TunnelConfiguration: Codable {
+ var name: String
+ let interface: InterfaceConfiguration
+ var peers: [PeerConfiguration] = []
+ init(name: String, interface: InterfaceConfiguration) {
+ self.name = name
+ self.interface = interface
+ }
+}
+
+class InterfaceConfiguration: Codable {
+ var privateKey: Data
+ var addresses: [String] = []
+ var listenPort: UInt64? = nil
+ var mtu: UInt64? = nil
+ var dns: String? = nil
+ init(privateKey: Data) {
+ self.privateKey = privateKey
+ }
+}
+
+class PeerConfiguration: Codable {
+ var publicKey: Data
+ var preSharedKey: Data?
+ var allowedIPs: [String] = []
+ var endpoint: String?
+ var persistentKeepAlive: UInt64?
+ init(publicKey: Data) {
+ self.publicKey = publicKey
+ }
+}