48 lines
1.2 KiB
Go
Raw Normal View History

2020-11-06 12:21:47 +01:00
package wireguard
var (
ClientCfgTpl = `[Interface]
2020-11-07 11:47:52 +01:00
#{{ .Client.Identifier }}
2020-11-06 12:21:47 +01:00
Address = {{ .Client.IPsStr }}
PrivateKey = {{ .Client.PrivateKey }}
{{ if ne (len .Server.DNS) 0 -}}
DNS = {{ .Server.DNSStr }}
{{- end }}
{{ if ne .Server.Mtu 0 -}}
MTU = {{.Server.Mtu}}
{{- end}}
[Peer]
PublicKey = {{ .Server.PublicKey }}
PresharedKey = {{ .Client.PresharedKey }}
AllowedIPs = {{ .Client.AllowedIPsStr }}
Endpoint = {{ .Server.Endpoint }}
{{ if and (ne .Server.PersistentKeepalive 0) (not .Client.IgnorePersistentKeepalive) -}}
PersistentKeepalive = {{.Server.PersistentKeepalive}}
{{- end}}
`
2020-11-09 20:26:34 +01:00
DeviceCfgTpl = `# Updated: {{ .Server.UpdatedAt }} / Created: {{ .Server.CreatedAt }}
[Interface]
{{- range .Server.IPs }}
Address = {{ . }}
{{- end }}
ListenPort = {{ .Server.ListenPort }}
PrivateKey = {{ .Server.PrivateKey }}
{{ if ne .Server.Mtu 0 -}}
MTU = {{.Server.Mtu}}
{{- end}}
PreUp = {{ .Server.PreUp }}
PostUp = {{ .Server.PostUp }}
PreDown = {{ .Server.PreDown }}
PostDown = {{ .Server.PostDown }}
{{ range .Clients }}
{{ if not .DeactivatedAt -}}
# {{.Identifier}} / {{.Email}} / Updated: {{.UpdatedAt}} / Created: {{.CreatedAt}}
[Peer]
PublicKey = {{ .PublicKey }}
PresharedKey = {{ .PresharedKey }}
AllowedIPs = {{ StringsJoin .IPs ", " }}
{{- end }}
{{ end }}`
2020-11-06 12:21:47 +01:00
)