Skip to content

Commit

Permalink
Fix address ip and cidr for vyatta and nixos
Browse files Browse the repository at this point in the history
  • Loading branch information
botto committed May 3, 2022
1 parent 29f35b5 commit 96631ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} persistent-keepalive {{ .Keepalive }}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} preshared-key {{ .Peer.PresharedKey.Key }}
{{ if gt (.Server.Network.IPNet.IP | len) 0 -}}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} allowed-ips {{ .Server.Network }}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} allowed-ips {{ .Server.Network.IPNet.IP }}/{{ .CidrSize }}
{{ end -}}
{{ if gt (.Server.Network6.IPNet.IP | len) 0 -}}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} allowed-ips {{ .Server.Network6 }}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} allowed-ips {{ .Server.Network6.IPNet.IP }}/{{ .CidrSize6 }}
{{ end -}}
{{ range .Server.Networks -}}
set interfaces wireguard {{ .Wgif }} peer {{ .Server.PrivateKey.PublicKey.Key }} allowed-ips {{ . }}
Expand Down Expand Up @@ -78,10 +78,10 @@ const nixosPeerConf = `networking.wireguard.interfaces = {{ "{" }}
presharedKey = "{{ .Peer.PresharedKey.Key }}";
allowedIPs = [
{{ if gt (.Server.Network.IPNet.IP | len) 0 -}}
"{{ .Server.Network }}"
"{{ .Server.Network.IPNet.IP }}/{{ .CidrSize }}"
{{ end -}}
{{ if gt (.Server.Network6.IPNet.IP | len) 0 -}}
"{{ .Server.Network6 }}"
"{{ .Server.Network6.IPNet.IP }}/{{ .CidrSize6 }}"
{{ end -}}
];
endpoint = "{{ .Endpoint }}:{{ .Server.ListenPort }}";
Expand Down

0 comments on commit 96631ec

Please sign in to comment.