Use IPAddressRange in the Configuration model

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-10-13 19:05:52 +05:30
parent 0ce6b9e79e
commit ede2a82c3b
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@
import Foundation import Foundation
@available(OSX 10.14, iOS 12.0, *)
class TunnelConfiguration: Codable { class TunnelConfiguration: Codable {
var name: String var name: String
let interface: InterfaceConfiguration let interface: InterfaceConfiguration
@ -18,9 +19,10 @@ class TunnelConfiguration: Codable {
} }
} }
@available(OSX 10.14, iOS 12.0, *)
class InterfaceConfiguration: Codable { class InterfaceConfiguration: Codable {
var privateKey: Data var privateKey: Data
var addresses: [String] = [] var addresses: [IPAddressRange] = []
var listenPort: UInt64? = nil var listenPort: UInt64? = nil
var mtu: UInt64? = nil var mtu: UInt64? = nil
var dns: String? = nil var dns: String? = nil
@ -29,10 +31,11 @@ class InterfaceConfiguration: Codable {
} }
} }
@available(OSX 10.14, iOS 12.0, *)
class PeerConfiguration: Codable { class PeerConfiguration: Codable {
var publicKey: Data var publicKey: Data
var preSharedKey: Data? var preSharedKey: Data?
var allowedIPs: [String] = [] var allowedIPs: [IPAddressRange] = []
var endpoint: String? var endpoint: String?
var persistentKeepAlive: UInt64? var persistentKeepAlive: UInt64?
init(publicKey: Data) { init(publicKey: Data) {