Fix AllowedIPs from ui to server config

this MR fixed AllowedIPs from this issue https://github.com/ngoduykhanh/wireguard-ui/issues/77
This commit is contained in:
kr1ptonec 2025-10-22 21:27:08 +07:00 committed by GitHub
parent 2fdafd34ca
commit 29232c6b36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -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}}