54 lines
1.3 KiB
Go
Raw Normal View History

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