Generate split allowed IPs in protocol configuration.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts 2018-08-07 21:31:43 +02:00
parent 4eca5e814c
commit 762618ee5a
1 changed files with 4 additions and 2 deletions

View File

@ -64,8 +64,10 @@ extension Tunnel {
if peer.persistentKeepalive > 0 {
settingsString += "persistent_keepalive_interval=\(peer.persistentKeepalive)"
}
if let allowedIPs = peer.allowedIPs {
settingsString += "allowed_ip=\(allowedIPs)" // TODO: split on ,
if let allowedIPs = peer.allowedIPs?.split(separator: ",") {
allowedIPs.forEach {
settingsString += "allowed_ip=\($0.trimmingCharacters(in: .whitespaces))"
}
}
return settingsString