:toda:
This commit is contained in:
13
template/conf/wg.client.conf
Normal file
13
template/conf/wg.client.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
[Interface]
|
||||
PrivateKey = {{ .PrivateKey|html }}
|
||||
Address = {{ .IpAllocation|html }}
|
||||
{{ if .DNS }}DNS = {{ .DNS|html }}
|
||||
MTU = {{ .MTU }}
|
||||
{{ else }}MTU = {{ .MTU }}{{ end }}
|
||||
|
||||
[Peer]
|
||||
PublicKey = {{ .PublicKey|html }}
|
||||
PresharedKey = {{ .PresharedKey|html }}
|
||||
AllowedIPs = {{ .AllowedIPS|html }}
|
||||
Endpoint = {{ .Endpoint|html }}:{{ .ListenPort|html }}
|
||||
PersistentKeepalive = {{ .PersistentKeepalive|html }}
|
24
template/conf/wg.conf
Normal file
24
template/conf/wg.conf
Normal file
@@ -0,0 +1,24 @@
|
||||
[Interface]
|
||||
Address = {{ .Server.Address|html }}
|
||||
ListenPort = {{ .Server.ListenPort|html }}
|
||||
PrivateKey = {{ .Server.PrivateKey|html }}
|
||||
MTU = {{ .Server.MTU|html }}
|
||||
PostUp = {{ .Server.PostUp|html }}
|
||||
PreDown = {{ .Server.PreDown|html }}
|
||||
PostDown = {{ .Server.PostDown|html }}
|
||||
Table = {{ .Server.Table|html }}
|
||||
|
||||
{{ range .Clients }}{{ if eq .Enabled true }}
|
||||
# ID: {{ .ID|html }}
|
||||
# Name: {{ .Name|html }}
|
||||
# Emil: {{ .Email|html }}
|
||||
# CreatedAt: {{ .CreatedAt|html }}
|
||||
# UpdatedAt: {{ .UpdatedAt|html }}
|
||||
# CreateUser: {{ .CreateUser|html }}
|
||||
[Peer]
|
||||
PublicKey = {{ .PublicKey|html }}
|
||||
PresharedKey = {{ .PresharedKey|html }}
|
||||
AllowedIPs = {{ .AllowedIPS|html }}
|
||||
PersistentKeepalive = {{ .PersistentKeepalive|html }}
|
||||
{{ if .Endpoint }}Endpoint = {{ .Endpoint|html }}{{ end }}
|
||||
{{ end }}{{ end }}
|
58
template/render_data/render_data.go
Normal file
58
template/render_data/render_data.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package render_data
|
||||
|
||||
type ServerSetting struct {
|
||||
EndpointAddress string `json:"endpointAddress"`
|
||||
DnsServer []string `json:"dnsServer"`
|
||||
MTU int `json:"MTU"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
FirewallMark string `json:"firewallMark"`
|
||||
Table string `json:"table"`
|
||||
ConfigFilePath string `json:"configFilePath"`
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
Address []string `json:"ipScope"`
|
||||
ListenPort uint64 `json:"listenPort"`
|
||||
PrivateKey string `json:"privateKey"`
|
||||
PublicKey string `json:"publicKey" `
|
||||
MTU int `json:"MTU"`
|
||||
PostUp string `json:"postUpScript"`
|
||||
PreDown string `json:"preDownScript"`
|
||||
PostDown string `json:"postDownScript"`
|
||||
Table string `json:"table"`
|
||||
Clients []Client `json:"clients"`
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
PresharedKey string `json:"presharedKey"`
|
||||
AllowedIPS string `json:"allowedIps"`
|
||||
PersistentKeepalive string `json:"persistentKeepalive"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
CreateUser string `json:"createUser"`
|
||||
Enabled bool `json:"enabled"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type Keys struct {
|
||||
PrivateKey string `json:"privateKey"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
PresharedKey string `json:"presharedKey"`
|
||||
}
|
||||
|
||||
type ClientConfig struct {
|
||||
PrivateKey string `json:"privateKey"`
|
||||
IpAllocation string `json:"ipAllocation"`
|
||||
MTU int `json:"MTU"`
|
||||
DNS string `json:"DNS"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
PresharedKey string `json:"presharedKey"`
|
||||
AllowedIPS string `json:"allowedIPS"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
ListenPort int `json:"listenPort"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
}
|
Reference in New Issue
Block a user