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
@@ -36,6 +36,27 @@ extension Interface {
}
}
func parse(attribute: Attribute) throws {
switch attribute.key {
case .address:
addresses = attribute.stringValue
case .dns:
dns = attribute.stringValue
case .listenPort:
if let port = Int16(attribute.stringValue) {
listenPort = port
}
case .mtu:
if let mtu = Int32(attribute.stringValue) {
self.mtu = mtu
}
case .privateKey:
privateKey = attribute.stringValue
default:
throw TunnelParseError.invalidLine(attribute.line)
}
}
}
enum InterfaceValidationError: Error {