Models for tunnel, interface and peer

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2018-10-13 17:44:46 +05:30
parent 78251e9a50
commit 3630543be5
2 changed files with 53 additions and 0 deletions
@@ -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
}
}