From 29232c6b368a915ee15039312c3795b78dfcb4cb Mon Sep 17 00:00:00 2001 From: kr1ptonec <49584163+kr1ptonec@users.noreply.github.com> Date: Wed, 22 Oct 2025 21:27:08 +0700 Subject: [PATCH] Fix AllowedIPs from ui to server config this MR fixed AllowedIPs from this issue https://github.com/ngoduykhanh/wireguard-ui/issues/77 --- templates/wg.conf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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}}