Export: fix up export format

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-11-01 17:31:50 +01:00
parent 3611f8cf5a
commit c5e35fee1e
1 changed files with 11 additions and 13 deletions

View File

@ -22,10 +22,9 @@ class WgQuickConfigFileWriter {
if let mtu = interface.mtu {
output.append("MTU = \(mtu)\n")
}
output.append("\n")
for peer in tc.peers {
output.append("[Peer]\n")
output.append("\n[Peer]\n")
output.append("PublicKey = \(peer.publicKey.base64EncodedString())\n")
if let preSharedKey = peer.preSharedKey {
output.append("PresharedKey = \(preSharedKey.base64EncodedString())\n")
@ -40,7 +39,6 @@ class WgQuickConfigFileWriter {
if let persistentKeepAlive = peer.persistentKeepAlive {
output.append("PersistentKeepalive = \(persistentKeepAlive)\n")
}
output.append("\n")
}
return output.data(using: .utf8)