🆕新增客户端配置文件模板
This commit is contained in:
parent
7c48551989
commit
91a1e61334
@ -11,8 +11,8 @@ type Client struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
SubnetRange string `json:"subnetRange"`
|
SubnetRange string `json:"subnetRange"`
|
||||||
IpAllocation string `json:"ipAllocation"`
|
IpAllocation string `json:"ipAllocation"`
|
||||||
AllowedIPS string `json:"allowedIPS"`
|
AllowedIps string `json:"allowedIPS"`
|
||||||
ExtraAllowedIPS string `json:"extraAllowedIPS"`
|
ExtraAllowedIps string `json:"extraAllowedIPS"`
|
||||||
Endpoint string `json:"endpoint"`
|
Endpoint string `json:"endpoint"`
|
||||||
UseServerDNS int `json:"useServerDNS"`
|
UseServerDNS int `json:"useServerDNS"`
|
||||||
EnableAfterCreation int `json:"enableAfterCreation"`
|
EnableAfterCreation int `json:"enableAfterCreation"`
|
||||||
|
@ -96,6 +96,7 @@ func (r clientRepo) Save(p param.SaveClient, adminId string) (client *entity.Cli
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
keys := template_data.Keys{
|
keys := template_data.Keys{
|
||||||
|
PrivateKey: privateKey.String(),
|
||||||
PublicKey: publicKey,
|
PublicKey: publicKey,
|
||||||
PresharedKey: presharedKey.String(),
|
PresharedKey: presharedKey.String(),
|
||||||
}
|
}
|
||||||
@ -114,6 +115,7 @@ func (r clientRepo) Save(p param.SaveClient, adminId string) (client *entity.Cli
|
|||||||
EnableAfterCreation: p.EnabledAfterCreation,
|
EnableAfterCreation: p.EnabledAfterCreation,
|
||||||
Keys: string(keysStr),
|
Keys: string(keysStr),
|
||||||
UserId: adminId,
|
UserId: adminId,
|
||||||
|
Enabled: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = r.Model(&entity.Client{}).Create(ent).Error
|
err = r.Model(&entity.Client{}).Create(ent).Error
|
||||||
|
11
template/wg.client.conf
Normal file
11
template/wg.client.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Interface]
|
||||||
|
PrivateKey = {{ .PrivateKey|html }}
|
||||||
|
Address = {{ .IpAllocation|html }}
|
||||||
|
MTU = {{ .MTU }}
|
||||||
|
|
||||||
|
[Peer]
|
||||||
|
PublicKey = {{ .PublicKey|html }}
|
||||||
|
PresharedKey = {{ .PresharedKey|html }}
|
||||||
|
AllowedIPs = {{ .AllowedIPS|html }}
|
||||||
|
Endpoint = {{ .Endpoint|html }}:{{ .ListenPort|html }}
|
||||||
|
PersistentKeepalive = {{ .PersistentKeepalive|html }}
|
@ -20,5 +20,5 @@ PublicKey = {{ .PublicKey|html }}
|
|||||||
PresharedKey = {{ .PresharedKey|html }}
|
PresharedKey = {{ .PresharedKey|html }}
|
||||||
AllowedIPs = {{ .AllowedIPS|html }}
|
AllowedIPs = {{ .AllowedIPS|html }}
|
||||||
PersistentKeepalive = {{ .PersistentKeepalive|html }}
|
PersistentKeepalive = {{ .PersistentKeepalive|html }}
|
||||||
Endpoint = {{ .Endpoint|html }}
|
{{ if .Endpoint }}Endpoint = {{ .Endpoint|html }}{{ end }}
|
||||||
{{ end }}{{ end }}
|
{{ end }}{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user