mirror of
https://github.com/h44z/wg-portal.git
synced 2025-08-25 14:31:14 +00:00
WIP: support different interface types: update config templates
This commit is contained in:
58
internal/wireguard/tpl/interface.tpl
Normal file
58
internal/wireguard/tpl/interface.tpl
Normal file
@@ -0,0 +1,58 @@
|
||||
# AUTOGENERATED FILE - DO NOT EDIT
|
||||
# -WGP- Interface: {{ .Interface.DeviceName }} / Updated: {{ .Interface.UpdatedAt }} / Created: {{ .Interface.CreatedAt }}
|
||||
# -WGP- Interface display name: {{ .Interface.DisplayName }}
|
||||
# -WGP- Interface mode: {{ .Interface.Type }}
|
||||
# -WGP- PublicKey = {{ .Interface.PublicKey }}
|
||||
|
||||
[Interface]
|
||||
|
||||
# Core settings
|
||||
PrivateKey = {{ .Interface.PrivateKey }}
|
||||
Address = {{ .Interface.IPsStr }}
|
||||
|
||||
# Misc. settings
|
||||
{{- if ne .Interface.ListenPort 0}}
|
||||
ListenPort = {{ .Interface.ListenPort }}
|
||||
{{- end}}
|
||||
{{- if ne .Interface.Mtu 0}}
|
||||
MTU = {{.Interface.Mtu}}
|
||||
{{- end}}
|
||||
{{- if ne .Interface.FirewallMark 0}}
|
||||
FwMark = {{.Interface.FirewallMark}}
|
||||
{{- end}}
|
||||
{{- if ne .Interface.RoutingTable ""}}
|
||||
Table = {{.Interface.RoutingTable}}
|
||||
{{- end}}
|
||||
{{- if .Interface.SaveConfig}}
|
||||
SaveConfig = true
|
||||
{{- end}}
|
||||
|
||||
# Interface hooks
|
||||
PreUp = {{ .Interface.PreUp }}
|
||||
PostUp = {{ .Interface.PostUp }}
|
||||
PreDown = {{ .Interface.PreDown }}
|
||||
PostDown = {{ .Interface.PostDown }}
|
||||
|
||||
#
|
||||
# Peers
|
||||
#
|
||||
|
||||
{{range .Peers}}
|
||||
{{- if not .DeactivatedAt}}
|
||||
# -WGP- Peer: {{.Identifier}} / Updated: {{.UpdatedAt}} / Created: {{.CreatedAt}}
|
||||
# -WGP- Peer email: {{.Email}}
|
||||
# -WGP- PrivateKey: {{.PrivateKey}}
|
||||
[Peer]
|
||||
PublicKey = {{ .PublicKey }}
|
||||
{{- if .PresharedKey}}
|
||||
PresharedKey = {{ .PresharedKey }}
|
||||
{{- end}}
|
||||
AllowedIPs = {{ .AllowedIPsStr }}
|
||||
{{- if ne .Endpoint ""}}
|
||||
Endpoint = {{ .Endpoint }}
|
||||
{{- end}}
|
||||
{{- if ne .PersistentKeepalive 0}}
|
||||
PersistentKeepalive = {{ .PersistentKeepalive }}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{end}}
|
28
internal/wireguard/tpl/peer.tpl
Normal file
28
internal/wireguard/tpl/peer.tpl
Normal file
@@ -0,0 +1,28 @@
|
||||
# AUTOGENERATED FILE - PROVIDED BY WIREGUARD PORTAL
|
||||
# WireGuard configuration: {{ .Peer.Identifier }}
|
||||
# -WGP- PublicKey: {{ .Peer.PublicKey }}
|
||||
|
||||
[Interface]
|
||||
|
||||
# Core settings
|
||||
PrivateKey = {{ .Peer.PrivateKey }}
|
||||
Address = {{ .Peer.IPsStr }}
|
||||
|
||||
# Misc. settings
|
||||
{{- if .Peer.DNSStr}}
|
||||
DNS = {{ .Peer.DNSStr }}
|
||||
{{- end}}
|
||||
{{- if ne .Peer.Mtu 0}}
|
||||
MTU = {{.Peer.Mtu}}
|
||||
{{- end}}
|
||||
|
||||
[Peer]
|
||||
PublicKey = {{ .Peer.EndpointPublicKey }}
|
||||
Endpoint = {{ .Server.Endpoint }}
|
||||
AllowedIPs = {{ .Peer.AllowedIPsStr }}
|
||||
{{- if .Peer.PresharedKey}}
|
||||
PresharedKey = {{ .Peer.PresharedKey }}
|
||||
{{- end}}
|
||||
{{- if ne .Peer.PersistentKeepalive 0}}
|
||||
PersistentKeepalive = {{.Peer.PersistentKeepalive}}
|
||||
{{- end}}
|
Reference in New Issue
Block a user