fix private subnets bug

This commit is contained in:
sunyu 2020-09-25 14:48:44 +08:00
parent 2b7a8d01c7
commit a89fb34555
5 changed files with 52 additions and 15 deletions

View file

@ -154,7 +154,7 @@
value="0.0.0.0/0">
</div>
<div class="form-group">
<label for="client_private_subnets" class="control-label">Allowed IPs</label>
<label for="client_private_subnets" class="control-label">Private Subnets</label>
<input type="text" data-role="tagsinput" class="form-control" id="client_private_subnets">
</div>
<div class="form-group">

View file

@ -20,5 +20,5 @@ PostDown = {{ .serverConfig.Interface.PostDown }}
[Peer]
PublicKey = {{ .Client.PublicKey }}
PresharedKey = {{ .Client.PresharedKey }}
AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{if .Client.PrivateSubnets}},{{end}}{{$first :=true}}{{range .Client.PrivateSubnets }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}
AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{if eq .Client.HasPrivateSubnet true}},{{$first :=true}}{{range .Client.PrivateSubnets }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{end}}
{{end}}{{end}}