mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-06-07 00:46:58 +03:00
Capitalize 'g' in Wireguard
This commit is contained in:
parent
74a7dc00d8
commit
9f093d97b1
10 changed files with 48 additions and 48 deletions
|
@ -186,9 +186,9 @@ rc-update add wgui default
|
||||||
|
|
||||||
### Using Docker
|
### Using Docker
|
||||||
|
|
||||||
Set `WGUI_MANAGE_RESTART=true` to manage Wireguard interface restarts.
|
Set `WGUI_MANAGE_RESTART=true` to manage WireGuard interface restarts.
|
||||||
Using `WGUI_MANAGE_START=true` can also replace the function of `wg-quick@wg0` service, to start Wireguard at boot, by
|
Using `WGUI_MANAGE_START=true` can also replace the function of `wg-quick@wg0` service, to start WireGuard at boot, by
|
||||||
running the container with `restart: unless-stopped`. These settings can also pick up changes to Wireguard Config File
|
running the container with `restart: unless-stopped`. These settings can also pick up changes to WireGuard Config File
|
||||||
Path, after restarting the container. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make
|
Path, after restarting the container. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make
|
||||||
this
|
this
|
||||||
feature work.
|
feature work.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
### Kernel Module
|
### Kernel Module
|
||||||
|
|
||||||
Depending on if the Wireguard kernel module is available on your system you have more or less choices which example to use.
|
Depending on if the WireGuard kernel module is available on your system you have more or less choices which example to use.
|
||||||
|
|
||||||
You can check if the kernel modules are available via the following command:
|
You can check if the kernel modules are available via the following command:
|
||||||
```shell
|
```shell
|
||||||
|
@ -21,10 +21,10 @@ For security reasons it's highly recommended to change them before the first sta
|
||||||
## Examples
|
## Examples
|
||||||
- **[system](system.yml)**
|
- **[system](system.yml)**
|
||||||
|
|
||||||
If you have Wireguard already installed on your system and only want to run the UI in docker this might fit the most.
|
If you have WireGuard already installed on your system and only want to run the UI in docker this might fit the most.
|
||||||
- **[linuxserver](linuxserver.yml)**
|
- **[linuxserver](linuxserver.yml)**
|
||||||
|
|
||||||
If you have the Wireguard kernel modules installed (included in the mainline kernel since version 5.6) but want it running inside of docker, this might fit the most.
|
If you have the WireGuard kernel modules installed (included in the mainline kernel since version 5.6) but want it running inside of docker, this might fit the most.
|
||||||
- **[boringtun](boringtun.yml)**
|
- **[boringtun](boringtun.yml)**
|
||||||
|
|
||||||
If Wireguard kernel modules are not available, you can switch to an userspace implementation like [boringtun](https://github.com/cloudflare/boringtun).
|
If WireGuard kernel modules are not available, you can switch to an userspace implementation like [boringtun](https://github.com/cloudflare/boringtun).
|
||||||
|
|
|
@ -347,7 +347,7 @@ func WireGuardClients(db store.IStore) echo.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetClients handler return a JSON list of Wireguard client data
|
// GetClients handler return a JSON list of WireGuard client data
|
||||||
func GetClients(db store.IStore) echo.HandlerFunc {
|
func GetClients(db store.IStore) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ func GetClients(db store.IStore) echo.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetClient handler returns a JSON object of Wireguard client data
|
// GetClient handler returns a JSON object of WireGuard client data
|
||||||
func GetClient(db store.IStore) echo.HandlerFunc {
|
func GetClient(db store.IStore) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
|
|
||||||
|
@ -419,12 +419,12 @@ func NewClient(db store.IStore) echo.HandlerFunc {
|
||||||
guid := xid.New()
|
guid := xid.New()
|
||||||
client.ID = guid.String()
|
client.ID = guid.String()
|
||||||
|
|
||||||
// gen Wireguard key pair
|
// gen WireGuard key pair
|
||||||
if client.PublicKey == "" {
|
if client.PublicKey == "" {
|
||||||
key, err := wgtypes.GeneratePrivateKey()
|
key, err := wgtypes.GeneratePrivateKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot generate wireguard key pair: ", err)
|
log.Error("Cannot generate wireguard key pair: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate Wireguard key pair"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate WireGuard key pair"})
|
||||||
}
|
}
|
||||||
client.PrivateKey = key.String()
|
client.PrivateKey = key.String()
|
||||||
client.PublicKey = key.PublicKey().String()
|
client.PublicKey = key.PublicKey().String()
|
||||||
|
@ -432,7 +432,7 @@ func NewClient(db store.IStore) echo.HandlerFunc {
|
||||||
_, err := wgtypes.ParseKey(client.PublicKey)
|
_, err := wgtypes.ParseKey(client.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot verify wireguard public key: ", err)
|
log.Error("Cannot verify wireguard public key: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify Wireguard public key"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify WireGuard public key"})
|
||||||
}
|
}
|
||||||
// check for duplicates
|
// check for duplicates
|
||||||
clients, err := db.GetClients(false)
|
clients, err := db.GetClients(false)
|
||||||
|
@ -454,7 +454,7 @@ func NewClient(db store.IStore) echo.HandlerFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot generated preshared key: ", err)
|
log.Error("Cannot generated preshared key: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{
|
||||||
false, "Cannot generate Wireguard preshared key",
|
false, "Cannot generate WireGuard preshared key",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
client.PresharedKey = presharedKey.String()
|
client.PresharedKey = presharedKey.String()
|
||||||
|
@ -465,7 +465,7 @@ func NewClient(db store.IStore) echo.HandlerFunc {
|
||||||
_, err := wgtypes.ParseKey(client.PresharedKey)
|
_, err := wgtypes.ParseKey(client.PresharedKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot verify wireguard preshared key: ", err)
|
log.Error("Cannot verify wireguard preshared key: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify Wireguard preshared key"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify WireGuard preshared key"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client.CreatedAt = time.Now().UTC()
|
client.CreatedAt = time.Now().UTC()
|
||||||
|
@ -577,12 +577,12 @@ func UpdateClient(db store.IStore) echo.HandlerFunc {
|
||||||
return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Extra Allowed IPs must be in CIDR format"})
|
return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Extra Allowed IPs must be in CIDR format"})
|
||||||
}
|
}
|
||||||
|
|
||||||
// update Wireguard Client PublicKey
|
// update WireGuard Client PublicKey
|
||||||
if client.PublicKey != _client.PublicKey && _client.PublicKey != "" {
|
if client.PublicKey != _client.PublicKey && _client.PublicKey != "" {
|
||||||
_, err := wgtypes.ParseKey(_client.PublicKey)
|
_, err := wgtypes.ParseKey(_client.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot verify provided Wireguard public key: ", err)
|
log.Error("Cannot verify provided WireGuard public key: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify provided Wireguard public key"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify provided WireGuard public key"})
|
||||||
}
|
}
|
||||||
// check for duplicates
|
// check for duplicates
|
||||||
clients, err := db.GetClients(false)
|
clients, err := db.GetClients(false)
|
||||||
|
@ -597,7 +597,7 @@ func UpdateClient(db store.IStore) echo.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When replacing any PublicKey, discard any locally stored Wireguard Client PrivateKey
|
// When replacing any PublicKey, discard any locally stored WireGuard Client PrivateKey
|
||||||
// Client PubKey no longer corresponds to locally stored PrivKey.
|
// Client PubKey no longer corresponds to locally stored PrivKey.
|
||||||
// QR code (needs PrivateKey) for this client is no longer possible now.
|
// QR code (needs PrivateKey) for this client is no longer possible now.
|
||||||
|
|
||||||
|
@ -607,12 +607,12 @@ func UpdateClient(db store.IStore) echo.HandlerFunc {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update Wireguard Client PresharedKey
|
// update WireGuard Client PresharedKey
|
||||||
if client.PresharedKey != _client.PresharedKey && _client.PresharedKey != "" {
|
if client.PresharedKey != _client.PresharedKey && _client.PresharedKey != "" {
|
||||||
_, err := wgtypes.ParseKey(_client.PresharedKey)
|
_, err := wgtypes.ParseKey(_client.PresharedKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot verify provided Wireguard preshared key: ", err)
|
log.Error("Cannot verify provided WireGuard preshared key: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify provided Wireguard preshared key"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot verify provided WireGuard preshared key"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,11 +770,11 @@ func WireGuardServerInterfaces(db store.IStore) echo.HandlerFunc {
|
||||||
func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc {
|
func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
|
|
||||||
// gen Wireguard key pair
|
// gen WireGuard key pair
|
||||||
key, err := wgtypes.GeneratePrivateKey()
|
key, err := wgtypes.GeneratePrivateKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cannot generate wireguard key pair: ", err)
|
log.Error("Cannot generate wireguard key pair: ", err)
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate Wireguard key pair"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate WireGuard key pair"})
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverKeyPair model.ServerKeypair
|
var serverKeyPair model.ServerKeypair
|
||||||
|
@ -783,7 +783,7 @@ func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc {
|
||||||
serverKeyPair.UpdatedAt = time.Now().UTC()
|
serverKeyPair.UpdatedAt = time.Now().UTC()
|
||||||
|
|
||||||
if err := db.SaveServerKeyPair(serverKeyPair); err != nil {
|
if err := db.SaveServerKeyPair(serverKeyPair); err != nil {
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate Wireguard key pair"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate WireGuard key pair"})
|
||||||
}
|
}
|
||||||
log.Infof("Updated wireguard server interfaces settings: %v", serverKeyPair)
|
log.Infof("Updated wireguard server interfaces settings: %v", serverKeyPair)
|
||||||
|
|
||||||
|
@ -936,7 +936,7 @@ func GlobalSettingSubmit(db store.IStore) echo.HandlerFunc {
|
||||||
|
|
||||||
// write config to the database
|
// write config to the database
|
||||||
if err := db.SaveGlobalSettings(globalSettings); err != nil {
|
if err := db.SaveGlobalSettings(globalSettings); err != nil {
|
||||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate Wireguard key pair"})
|
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot generate WireGuard key pair"})
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Updated global settings: %v", globalSettings)
|
log.Infof("Updated global settings: %v", globalSettings)
|
||||||
|
@ -1010,7 +1010,7 @@ func SuggestIPAllocation(db store.IStore) echo.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApplyServerConfig handler to write config file and restart Wireguard server
|
// ApplyServerConfig handler to write config file and restart WireGuard server
|
||||||
func ApplyServerConfig(db store.IStore, tmplDir fs.FS) echo.HandlerFunc {
|
func ApplyServerConfig(db store.IStore, tmplDir fs.FS) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -116,7 +116,7 @@ func init() {
|
||||||
// print only if log level is INFO or lower
|
// print only if log level is INFO or lower
|
||||||
if lvl, _ := util.ParseLogLevel(util.LookupEnvOrString(util.LogLevel, "INFO")); lvl <= log.INFO {
|
if lvl, _ := util.ParseLogLevel(util.LookupEnvOrString(util.LogLevel, "INFO")); lvl <= log.INFO {
|
||||||
// print app information
|
// print app information
|
||||||
fmt.Println("Wireguard UI")
|
fmt.Println("WireGuard UI")
|
||||||
fmt.Println("App Version\t:", appVersion)
|
fmt.Println("App Version\t:", appVersion)
|
||||||
fmt.Println("Git Commit\t:", gitCommit)
|
fmt.Println("Git Commit\t:", gitCommit)
|
||||||
fmt.Println("Git Ref\t\t:", gitRef)
|
fmt.Println("Git Ref\t\t:", gitRef)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "wireguard-ui",
|
"name": "wireguard-ui",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Wireguard web interface",
|
"description": "WireGuard web interface",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "git@github.com:ngoduykhanh/wireguard-ui.git",
|
"repository": "git@github.com:ngoduykhanh/wireguard-ui.git",
|
||||||
"author": "Khanh Ngo <k@ndk.name>",
|
"author": "Khanh Ngo <k@ndk.name>",
|
||||||
|
|
|
@ -22,7 +22,7 @@ About
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="card card-success">
|
<div class="card card-success">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">About Wireguard-UI</h3>
|
<h3 class="card-title">About WireGuard-UI</h3>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-header -->
|
<!-- /.card-header -->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
@ -63,7 +63,7 @@ About
|
||||||
</div>
|
</div>
|
||||||
<strong>Copyright ©
|
<strong>Copyright ©
|
||||||
<script>document.write(new Date().getFullYear())</script>
|
<script>document.write(new Date().getFullYear())</script>
|
||||||
<a href="https://github.com/idressos/wireguard-ui">Wireguard UI</a>.
|
<a href="https://github.com/idressos/wireguard-ui">WireGuard UI</a>.
|
||||||
</strong> All rights reserved.
|
</strong> All rights reserved.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
<a href="{{.basePath}}/wg-server" class="nav-link {{if eq .baseData.Active "wg-server" }}active{{end}}">
|
<a href="{{.basePath}}/wg-server" class="nav-link {{if eq .baseData.Active "wg-server" }}active{{end}}">
|
||||||
<i class="nav-icon fas fa-server"></i>
|
<i class="nav-icon fas fa-server"></i>
|
||||||
<p>
|
<p>
|
||||||
Wireguard Server
|
WireGuard Server
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title">New Wireguard Client</h4>
|
<h4 class="modal-title">New WireGuard Client</h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -335,7 +335,7 @@
|
||||||
<div class="float-right d-none d-sm-block">
|
<div class="float-right d-none d-sm-block">
|
||||||
<b>Version</b> {{ .appVersion }}
|
<b>Version</b> {{ .appVersion }}
|
||||||
</div>
|
</div>
|
||||||
<strong>Copyright © <script>document.write(new Date().getFullYear())</script> <a href="https://github.com/idressos/wireguard-ui">Wireguard UI</a>.</strong> All rights
|
<strong>Copyright © <script>document.write(new Date().getFullYear())</script> <a href="https://github.com/idressos/wireguard-ui">WireGuard UI</a>.</strong> All rights
|
||||||
reserved.
|
reserved.
|
||||||
</footer>
|
</footer>
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -22,7 +22,7 @@ Global Settings
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="card card-success">
|
<div class="card card-success">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Wireguard Global Settings</h3>
|
<h3 class="card-title">WireGuard Global Settings</h3>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-header -->
|
<!-- /.card-header -->
|
||||||
<!-- form start -->
|
<!-- form start -->
|
||||||
|
@ -68,7 +68,7 @@ Global Settings
|
||||||
value="{{ .globalSettings.Table }}">
|
value="{{ .globalSettings.Table }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="config_file_path">Wireguard Config File Path</label>
|
<label for="config_file_path">WireGuard Config File Path</label>
|
||||||
<input type="text" class="form-control" id="config_file_path"
|
<input type="text" class="form-control" id="config_file_path"
|
||||||
name="config_file_path" placeholder="E.g. /etc/wireguard/wg0.conf"
|
name="config_file_path" placeholder="E.g. /etc/wireguard/wg0.conf"
|
||||||
value="{{ .globalSettings.ConfigFilePath }}">
|
value="{{ .globalSettings.ConfigFilePath }}">
|
||||||
|
@ -92,7 +92,7 @@ Global Settings
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<dl>
|
<dl>
|
||||||
<dt>1. Endpoint Address</dt>
|
<dt>1. Endpoint Address</dt>
|
||||||
<dd>The public IP address of your Wireguard server that the client will connect to. Click on
|
<dd>The public IP address of your WireGuard server that the client will connect to. Click on
|
||||||
<strong>Suggest</strong> button to auto detect the public IP address of your server.</dd>
|
<strong>Suggest</strong> button to auto detect the public IP address of your server.</dd>
|
||||||
<dt>2. DNS Servers</dt>
|
<dt>2. DNS Servers</dt>
|
||||||
<dd>The DNS servers will be set to client config.</dd>
|
<dd>The DNS servers will be set to client config.</dd>
|
||||||
|
@ -110,8 +110,8 @@ Global Settings
|
||||||
<dd>Add a matching <code>fwmark</code> on all packets going out of a WireGuard non-default-route tunnel. Default value: <code>0xca6c</code></dd>
|
<dd>Add a matching <code>fwmark</code> on all packets going out of a WireGuard non-default-route tunnel. Default value: <code>0xca6c</code></dd>
|
||||||
<dt>6. Table</dt>
|
<dt>6. Table</dt>
|
||||||
<dd>Value for the <code>Table</code> setting in the wg conf file. Default value: <code>auto</code></dd>
|
<dd>Value for the <code>Table</code> setting in the wg conf file. Default value: <code>auto</code></dd>
|
||||||
<dt>7. Wireguard Config File Path</dt>
|
<dt>7. WireGuard Config File Path</dt>
|
||||||
<dd>The path of your Wireguard server config file. Please make sure the parent directory
|
<dd>The path of your WireGuard server config file. Please make sure the parent directory
|
||||||
exists and is writable.</dd>
|
exists and is writable.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -195,7 +195,7 @@ Global Settings
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// Wireguard Interface DNS server tag input
|
// WireGuard Interface DNS server tag input
|
||||||
$("#dns_servers").tagsInput({
|
$("#dns_servers").tagsInput({
|
||||||
'width': '100%',
|
'width': '100%',
|
||||||
'height': '75%',
|
'height': '75%',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{define "title"}}
|
{{define "title"}}
|
||||||
Wireguard Server
|
WireGuard Server
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "top_css"}}
|
{{define "top_css"}}
|
||||||
|
@ -10,13 +10,13 @@ Wireguard Server
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "page_title"}}
|
{{define "page_title"}}
|
||||||
Wireguard Server Settings
|
WireGuard Server Settings
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "page_content"}}
|
{{define "page_content"}}
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- <h5 class="mt-4 mb-2">Wireguard Server</h5> -->
|
<!-- <h5 class="mt-4 mb-2">WireGuard Server</h5> -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- left column -->
|
<!-- left column -->
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -109,7 +109,7 @@ Wireguard Server Settings
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>Are you sure to generate a new key pair for the Wireguard server?<br/>
|
<p>Are you sure to generate a new key pair for the WireGuard server?<br/>
|
||||||
The existing Client's peer public key need to be updated to keep the connection working.</p>
|
The existing Client's peer public key need to be updated to keep the connection working.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer justify-content-between">
|
<div class="modal-footer justify-content-between">
|
||||||
|
@ -142,7 +142,7 @@ Wireguard Server Settings
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#modal_new_client").modal('hide');
|
$("#modal_new_client").modal('hide');
|
||||||
toastr.success('Updated Wireguard server interface addresses successfully');
|
toastr.success('Updated WireGuard server interface addresses successfully');
|
||||||
},
|
},
|
||||||
error: function(jqXHR, exception) {
|
error: function(jqXHR, exception) {
|
||||||
const responseJson = jQuery.parseJSON(jqXHR.responseText);
|
const responseJson = jQuery.parseJSON(jqXHR.responseText);
|
||||||
|
@ -152,7 +152,7 @@ Wireguard Server Settings
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// Wireguard Interface Addresses tag input
|
// WireGuard Interface Addresses tag input
|
||||||
$("#addresses").tagsInput({
|
$("#addresses").tagsInput({
|
||||||
'width': '100%',
|
'width': '100%',
|
||||||
// 'height': '75%',
|
// 'height': '75%',
|
||||||
|
@ -169,7 +169,7 @@ Wireguard Server Settings
|
||||||
$("#addresses").addTag('{{.}}');
|
$("#addresses").addTag('{{.}}');
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
// Wireguard Interface Addresses form validation
|
// WireGuard Interface Addresses form validation
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.validator.setDefaults({
|
$.validator.setDefaults({
|
||||||
submitHandler: function () {
|
submitHandler: function () {
|
||||||
|
@ -205,7 +205,7 @@ Wireguard Server Settings
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wireguard Key Pair generation confirmation button
|
// WireGuard Key Pair generation confirmation button
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#btn_generate_confirm").click(function () {
|
$("#btn_generate_confirm").click(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -383,7 +383,7 @@ func ValidateIPAllocation(serverAddresses []string, ipAllocatedList []string, ip
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteWireGuardServerConfig to write Wireguard server config. e.g. wg0.conf
|
// WriteWireGuardServerConfig to write WireGuard server config. e.g. wg0.conf
|
||||||
func WriteWireGuardServerConfig(tmplDir fs.FS, serverConfig model.Server, clientDataList []model.ClientData, usersList []model.User, globalSettings model.GlobalSetting) error {
|
func WriteWireGuardServerConfig(tmplDir fs.FS, serverConfig model.Server, clientDataList []model.ClientData, usersList []model.User, globalSettings model.GlobalSetting) error {
|
||||||
var tmplWireguardConf string
|
var tmplWireguardConf string
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue