Models for tunnel, interface and peer
This commit is contained in:
parent
9443ee7e30
commit
995320b958
|
@ -10,6 +10,7 @@
|
|||
6F7774E1217181B1006A79B3 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F7774DF217181B1006A79B3 /* MainViewController.swift */; };
|
||||
6F7774E2217181B1006A79B3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F7774E0217181B1006A79B3 /* AppDelegate.swift */; };
|
||||
6F7774E421718281006A79B3 /* TunnelsListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F7774E321718281006A79B3 /* TunnelsListTableViewController.swift */; };
|
||||
6F7774E82172020C006A79B3 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F7774E72172020C006A79B3 /* Configuration.swift */; };
|
||||
6FF4AC1F211EC472002C96EB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6FF4AC1E211EC472002C96EB /* Assets.xcassets */; };
|
||||
6FF4AC22211EC472002C96EB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6FF4AC20211EC472002C96EB /* LaunchScreen.storyboard */; };
|
||||
6FF4AC472120B9E0002C96EB /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FF4AC462120B9E0002C96EB /* NetworkExtension.framework */; };
|
||||
|
@ -19,6 +20,7 @@
|
|||
6F7774DF217181B1006A79B3 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
|
||||
6F7774E0217181B1006A79B3 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
6F7774E321718281006A79B3 /* TunnelsListTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelsListTableViewController.swift; sourceTree = "<group>"; };
|
||||
6F7774E72172020C006A79B3 /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
|
||||
6FF4AC14211EC46F002C96EB /* WireGuard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WireGuard.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6FF4AC1E211EC472002C96EB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
6FF4AC21211EC472002C96EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
|
@ -58,6 +60,14 @@
|
|||
path = iOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6F7774E6217201E0006A79B3 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6F7774E72172020C006A79B3 /* Configuration.swift */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6FF4AC0B211EC46F002C96EB = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -78,6 +88,7 @@
|
|||
6FF4AC16211EC46F002C96EB /* WireGuard */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6F7774E6217201E0006A79B3 /* Model */,
|
||||
6F7774DD217181B1006A79B3 /* UI */,
|
||||
6FF4AC482120B9E0002C96EB /* WireGuard.entitlements */,
|
||||
6FF4AC1E211EC472002C96EB /* Assets.xcassets */,
|
||||
|
@ -173,6 +184,7 @@
|
|||
files = (
|
||||
6F7774E421718281006A79B3 /* TunnelsListTableViewController.swift in Sources */,
|
||||
6F7774E2217181B1006A79B3 /* AppDelegate.swift in Sources */,
|
||||
6F7774E82172020C006A79B3 /* Configuration.swift in Sources */,
|
||||
6F7774E1217181B1006A79B3 /* MainViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue