Add string conversion for tunnel config.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts
2018-08-29 15:01:59 +02:00
parent cd6cb37163
commit b1aadaf82c
3 changed files with 52 additions and 0 deletions
@@ -57,6 +57,20 @@ extension Interface {
}
}
func export() -> String {
var exportString = "[Interface]\n"
if let privateKey = privateKey {
exportString.append("PrivateKey=\(privateKey)")
}
if listenPort > 0 {
exportString.append("ListenPort=\(listenPort)")
}
exportString.append("\n")
return exportString
}
}
enum InterfaceValidationError: Error {