diff --git a/internal/wireguard/template.go b/internal/wireguard/template.go index 5f794ce..3b65e57 100644 --- a/internal/wireguard/template.go +++ b/internal/wireguard/template.go @@ -5,7 +5,7 @@ var ( [Interface] Address = {{ .Client.IPsStr }} PrivateKey = {{ .Client.PrivateKey }} -{{if .Server.DNSStr -}} +{{- if .Server.DNSStr}} DNS = {{ .Server.DNSStr }} {{- end}} {{- if ne .Server.Mtu 0}} @@ -14,19 +14,19 @@ MTU = {{.Server.Mtu}} [Peer] PublicKey = {{ .Server.PublicKey }} -{{- if .Client.PresharedKey -}} +{{- if .Client.PresharedKey}} PresharedKey = {{ .Client.PresharedKey }} -{{- end -}} +{{- end}} AllowedIPs = {{ .Client.AllowedIPsStr }} Endpoint = {{ .Server.Endpoint }} -{{if and (ne .Server.PersistentKeepalive 0) (not .Client.IgnorePersistentKeepalive) -}} +{{- if and (ne .Server.PersistentKeepalive 0) (not .Client.IgnorePersistentKeepalive)}} PersistentKeepalive = {{.Server.PersistentKeepalive}} {{- end}} ` DeviceCfgTpl = `# AUTOGENERATED FILE - DO NOT EDIT # Updated: {{ .Server.UpdatedAt }} / Created: {{ .Server.CreatedAt }} [Interface] -{{- range .Server.IPs }} +{{- range .Server.IPs}} Address = {{ . }} {{- end}} ListenPort = {{ .Server.ListenPort }}