Added ability to add tunnels with a QR code scan. Logic in place to parse conf files as well.

Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
This commit is contained in:
Eric Kuck
2018-08-21 11:00:41 -05:00
parent c2b591cc44
commit 39ae9db11c
10 changed files with 325 additions and 8 deletions
+19
View File
@@ -44,6 +44,25 @@ extension Peer {
}
}
func parse(attribute: Attribute) throws {
switch attribute.key {
case .allowedIPs:
allowedIPs = attribute.stringValue
case .endpoint:
endpoint = attribute.stringValue
case .persistentKeepalive:
if let keepAlive = Int32(attribute.stringValue) {
persistentKeepalive = keepAlive
}
case .presharedKey:
presharedKey = attribute.stringValue
case .publicKey:
publicKey = attribute.stringValue
default:
throw TunnelParseError.invalidLine(attribute.line)
}
}
}
enum PeerValidationError: Error {