mirror of
https://github.com/h44z/wg-portal.git
synced 2025-08-25 14:31:14 +00:00
support different interface types: client and server mode
This commit is contained in:
@@ -10,13 +10,16 @@
|
||||
PrivateKey = {{ .Interface.PrivateKey }}
|
||||
Address = {{ .Interface.IPsStr }}
|
||||
|
||||
# Misc. settings
|
||||
# Misc. settings (optional)
|
||||
{{- if ne .Interface.ListenPort 0}}
|
||||
ListenPort = {{ .Interface.ListenPort }}
|
||||
{{- end}}
|
||||
{{- if ne .Interface.Mtu 0}}
|
||||
MTU = {{.Interface.Mtu}}
|
||||
{{- end}}
|
||||
{{- if and (ne .Interface.DNSStr "") (eq $.Interface.Type "client")}}
|
||||
DNS = {{ .Interface.DNSStr }}
|
||||
{{- end}}
|
||||
{{- if ne .Interface.FirewallMark 0}}
|
||||
FwMark = {{.Interface.FirewallMark}}
|
||||
{{- end}}
|
||||
@@ -27,11 +30,19 @@ Table = {{.Interface.RoutingTable}}
|
||||
SaveConfig = true
|
||||
{{- end}}
|
||||
|
||||
# Interface hooks
|
||||
# Interface hooks (optional)
|
||||
{{- if .Interface.PreUp}}
|
||||
PreUp = {{ .Interface.PreUp }}
|
||||
{{- end}}
|
||||
{{- if .Interface.PostUp}}
|
||||
PostUp = {{ .Interface.PostUp }}
|
||||
{{- end}}
|
||||
{{- if .Interface.PreDown}}
|
||||
PreDown = {{ .Interface.PreDown }}
|
||||
{{- end}}
|
||||
{{- if .Interface.PostDown}}
|
||||
PostDown = {{ .Interface.PostDown }}
|
||||
{{- end}}
|
||||
|
||||
#
|
||||
# Peers
|
||||
@@ -43,12 +54,24 @@ PostDown = {{ .Interface.PostDown }}
|
||||
# -WGP- Peer email: {{.Email}}
|
||||
# -WGP- PrivateKey: {{.PrivateKey}}
|
||||
[Peer]
|
||||
{{- if eq $.Interface.Type "server"}}
|
||||
PublicKey = {{ .PublicKey }}
|
||||
{{- end}}
|
||||
{{- if eq $.Interface.Type "client"}}
|
||||
PublicKey = {{ .EndpointPublicKey }}
|
||||
{{- end}}
|
||||
{{- if .PresharedKey}}
|
||||
PresharedKey = {{ .PresharedKey }}
|
||||
{{- end}}
|
||||
{{- if eq $.Interface.Type "server"}}
|
||||
AllowedIPs = {{ .IPsStr }}
|
||||
{{- end}}
|
||||
{{- if eq $.Interface.Type "client"}}
|
||||
{{- if .AllowedIPsStr}}
|
||||
AllowedIPs = {{ .AllowedIPsStr }}
|
||||
{{- if and (ne .Endpoint "") (ne $.Interface.Type "server")}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{- if and (ne .Endpoint "") (eq $.Interface.Type "client")}}
|
||||
Endpoint = {{ .Endpoint }}
|
||||
{{- end}}
|
||||
{{- if ne .PersistentKeepalive 0}}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
PrivateKey = {{ .Peer.PrivateKey }}
|
||||
Address = {{ .Peer.IPsStr }}
|
||||
|
||||
# Misc. settings
|
||||
# Misc. settings (optional)
|
||||
{{- if .Peer.DNSStr}}
|
||||
DNS = {{ .Peer.DNSStr }}
|
||||
{{- end}}
|
||||
|
Reference in New Issue
Block a user