Generate split allowed IPs in protocol configuration.

This commit is contained in:
Jeroen Leenarts 2018-08-07 21:31:43 +02:00
parent cf0ccbf0d1
commit d449817a45
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