diff --git a/templates/wg.conf b/templates/wg.conf index 34891f0..473ba82 100644 --- a/templates/wg.conf +++ b/templates/wg.conf @@ -27,7 +27,14 @@ Table = {{ .globalSettings.Table }} [Peer] PublicKey = {{ .Client.PublicKey }} {{if .Client.PresharedKey}}PresharedKey = {{ .Client.PresharedKey }}{{end}} -AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{range .Client.ExtraAllowedIPs }},{{.}}{{end}} +AllowedIPs = {{ $first := true }} +{{- range .Client.AllowedIPs -}} + {{- if not $first}}, {{ end -}}{{ . -}}{{ $first = false -}} +{{- end -}} +{{- range .Client.ExtraAllowedIPs -}} + {{- if not $first}}, {{ end -}}{{ . -}}{{ $first = false -}} +{{- end }} +{{"\n"}} {{if $.globalSettings.PersistentKeepalive}}PersistentKeepalive = {{ $.globalSettings.PersistentKeepalive }}{{end}} {{if .Client.Endpoint}}Endpoint = {{ .Client.Endpoint }}{{end}} {{end}}{{end}}