mirror of
				https://github.com/h44z/wg-portal.git
				synced 2025-11-03 23:56:18 +00:00 
			
		
		
		
	V2 alpha - initial version (#172)
Initial alpha codebase for version 2 of WireGuard Portal. This version is considered unstable and incomplete (for example, no public REST API)! Use with care! Fixes/Implements the following issues: - OAuth support #154, #1 - New Web UI with internationalisation support #98, #107, #89, #62 - Postgres Support #49 - Improved Email handling #47, #119 - DNS Search Domain support #46 - Bugfixes #94, #48 --------- Co-authored-by: Fabian Wechselberger <wechselbergerf@hotmail.com>
This commit is contained in:
		
							
								
								
									
										89
									
								
								internal/app/configfile/tpl_files/wg_interface.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								internal/app/configfile/tpl_files/wg_interface.tpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,89 @@
 | 
			
		||||
# AUTOGENERATED FILE - DO NOT EDIT
 | 
			
		||||
# This file uses wg-quick format.
 | 
			
		||||
# See https://man7.org/linux/man-pages/man8/wg-quick.8.html#CONFIGURATION
 | 
			
		||||
# Lines starting with the -WGP- tag are used by
 | 
			
		||||
# the WireGuard Portal configuration parser.
 | 
			
		||||
 | 
			
		||||
# -WGP- WIREGUARD PORTAL CONFIGURATION FILE
 | 
			
		||||
# -WGP- version {{ .Portal.Version }}
 | 
			
		||||
 | 
			
		||||
[Interface]
 | 
			
		||||
# -WGP- Interface: {{ .Interface.Identifier }}
 | 
			
		||||
# -WGP- Created: {{ .Interface.CreatedAt }}
 | 
			
		||||
# -WGP- Updated: {{ .Interface.UpdatedAt }}
 | 
			
		||||
# -WGP- Display name: {{ .Interface.DisplayName }}
 | 
			
		||||
# -WGP- Interface mode: {{ .Interface.Type }}
 | 
			
		||||
# -WGP- PublicKey = {{ .Interface.KeyPair.PublicKey }}
 | 
			
		||||
 | 
			
		||||
# Core settings
 | 
			
		||||
PrivateKey = {{ .Interface.KeyPair.PrivateKey }}
 | 
			
		||||
Address = {{ CidrsToString .Interface.Addresses }}
 | 
			
		||||
 | 
			
		||||
# 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}}
 | 
			
		||||
{{- if ne .Interface.RoutingTable ""}}
 | 
			
		||||
Table = {{.Interface.RoutingTable}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if .Interface.SaveConfig}}
 | 
			
		||||
SaveConfig = true
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
{{range .Peers}}
 | 
			
		||||
{{- if not .IsDisabled}}
 | 
			
		||||
[Peer]
 | 
			
		||||
# -WGP- Peer: {{.Identifier}}
 | 
			
		||||
# -WGP- Created: {{.CreatedAt}}
 | 
			
		||||
# -WGP- Updated: {{.UpdatedAt}}
 | 
			
		||||
# -WGP- Display name: {{ .DisplayName }}
 | 
			
		||||
{{- if .Interface.KeyPair.PrivateKey}}
 | 
			
		||||
# -WGP- PrivateKey: {{.Interface.KeyPair.PrivateKey}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
PublicKey = {{ .Interface.KeyPair.PublicKey }}
 | 
			
		||||
{{- if .PresharedKey}}
 | 
			
		||||
PresharedKey = {{ .PresharedKey }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if eq $.Interface.Type "server"}}
 | 
			
		||||
AllowedIPs = {{ CidrsToString .Interface.Addresses }}{{if ne .ExtraAllowedIPsStr ""}}, {{ .ExtraAllowedIPsStr }}{{end}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if eq $.Interface.Type "client"}}
 | 
			
		||||
{{- if .AllowedIPsStr.GetValue}}
 | 
			
		||||
AllowedIPs = {{ .AllowedIPsStr.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if and (ne .Endpoint.GetValue "") (eq $.Interface.Type "client")}}
 | 
			
		||||
Endpoint = {{ .Endpoint.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if and (ne .PersistentKeepalive.GetValue 0)  (eq $.Interface.Type "client")}}
 | 
			
		||||
PersistentKeepalive = {{ .PersistentKeepalive.GetValue  }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{end}}
 | 
			
		||||
							
								
								
									
										65
									
								
								internal/app/configfile/tpl_files/wg_peer.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								internal/app/configfile/tpl_files/wg_peer.tpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
# AUTOGENERATED FILE - DO NOT EDIT
 | 
			
		||||
# This file uses wg-quick format.
 | 
			
		||||
# See https://man7.org/linux/man-pages/man8/wg-quick.8.html#CONFIGURATION
 | 
			
		||||
# Lines starting with the -WGP- tag are used by
 | 
			
		||||
# the WireGuard Portal configuration parser.
 | 
			
		||||
 | 
			
		||||
# -WGP- WIREGUARD PORTAL CONFIGURATION FILE
 | 
			
		||||
# -WGP- version {{ .Portal.Version }}
 | 
			
		||||
 | 
			
		||||
[Interface]
 | 
			
		||||
# -WGP- Peer: {{.Peer.Identifier}}
 | 
			
		||||
# -WGP- Created: {{.Peer.CreatedAt}}
 | 
			
		||||
# -WGP- Updated: {{.Peer.UpdatedAt}}
 | 
			
		||||
# -WGP- Display name: {{ .Peer.DisplayName }}
 | 
			
		||||
# -WGP- PublicKey: {{ .Peer.Interface.KeyPair.PublicKey }}
 | 
			
		||||
{{- if eq .Peer.Interface.Type "server"}}
 | 
			
		||||
# -WGP- Peer type: server
 | 
			
		||||
{{else}}
 | 
			
		||||
# -WGP- Peer type: client
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
# Core settings
 | 
			
		||||
PrivateKey = {{ .Peer.Interface.KeyPair.PrivateKey }}
 | 
			
		||||
Address = {{ CidrsToString .Peer.Interface.Addresses }}
 | 
			
		||||
 | 
			
		||||
# Misc. settings (optional)
 | 
			
		||||
{{- if .Peer.Interface.DnsStr.GetValue}}
 | 
			
		||||
DNS = {{ .Peer.Interface.DnsStr.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if ne .Peer.Interface.Mtu.GetValue 0}}
 | 
			
		||||
MTU = {{ .Peer.Interface.Mtu.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if ne .Peer.Interface.FirewallMark.GetValue 0}}
 | 
			
		||||
FwMark = {{ .Peer.Interface.FirewallMark.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if ne .Peer.Interface.RoutingTable.GetValue ""}}
 | 
			
		||||
Table = {{ .Peer.Interface.RoutingTable.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
# Interface hooks (optional)
 | 
			
		||||
{{- if .Peer.Interface.PreUp.GetValue}}
 | 
			
		||||
PreUp = {{ .Peer.Interface.PreUp.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if .Peer.Interface.PostUp.GetValue}}
 | 
			
		||||
PostUp = {{ .Peer.Interface.PostUp.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if .Peer.Interface.PreDown.GetValue}}
 | 
			
		||||
PreDown = {{ .Peer.Interface.PreDown.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if .Peer.Interface.PostDown.GetValue}}
 | 
			
		||||
PostDown = {{ .Peer.Interface.PostDown.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
[Peer]
 | 
			
		||||
PublicKey = {{ .Peer.EndpointPublicKey.GetValue }}
 | 
			
		||||
Endpoint = {{ .Peer.Endpoint.GetValue }}
 | 
			
		||||
{{- if .Peer.AllowedIPsStr.GetValue}}
 | 
			
		||||
AllowedIPs = {{ .Peer.AllowedIPsStr.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if .Peer.PresharedKey}}
 | 
			
		||||
PresharedKey = {{ .Peer.PresharedKey }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- if and (ne .Peer.PersistentKeepalive.GetValue 0) (eq .Peer.Interface.Type "client")}}
 | 
			
		||||
PersistentKeepalive = {{ .Peer.PersistentKeepalive.GetValue }}
 | 
			
		||||
{{- end}}
 | 
			
		||||
		Reference in New Issue
	
	Block a user