mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-21 20:12:33 +03:00
Added Table to global settings
Added Table to UI global settings view Added Table to wg conf template Added Table to settings model Added Table with default value `auto` to config util Updated README
This commit is contained in:
parent
f256668a99
commit
bd4a3312f4
6 changed files with 20 additions and 2 deletions
|
@ -58,6 +58,7 @@ Note:
|
|||
| `WGUI_MTU` | The default MTU used in global settings | `1450` |
|
||||
| `WGUI_PERSISTENT_KEEPALIVE` | The default persistent keepalive for WireGuard in global settings | `15` |
|
||||
| `WGUI_FORWARD_MARK` | The default WireGuard forward mark | `0xca6c` |
|
||||
| `WGUI_TABLE` | The default WireGuard table value settings | `auto` |
|
||||
| `WGUI_CONFIG_FILE_PATH` | The default WireGuard config file path used in global settings | `/etc/wireguard/wg0.conf` |
|
||||
| `WG_CONF_TEMPLATE` | The custom `wg.conf` config file template. Please refer to our [default template](https://github.com/ngoduykhanh/wireguard-ui/blob/master/templates/wg.conf) | N/A |
|
||||
| `EMAIL_FROM_ADDRESS` | The sender email address | N/A |
|
||||
|
|
|
@ -11,6 +11,7 @@ type GlobalSetting struct {
|
|||
MTU int `json:"mtu,string"`
|
||||
PersistentKeepalive int `json:"persistent_keepalive,string"`
|
||||
ForwardMark string `json:"forward_mark"`
|
||||
Table string `json:"table"`
|
||||
ConfigFilePath string `json:"config_file_path"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ func (o *JsonDB) Init() error {
|
|||
globalSetting.MTU = util.LookupEnvOrInt(util.MTUEnvVar, util.DefaultMTU)
|
||||
globalSetting.PersistentKeepalive = util.LookupEnvOrInt(util.PersistentKeepaliveEnvVar, util.DefaultPersistentKeepalive)
|
||||
globalSetting.ForwardMark = util.LookupEnvOrString(util.ForwardMarkEnvVar, util.DefaultForwardMark)
|
||||
globalSetting.Table = util.LookupEnvOrString(util.TableEnvVar, util.DefaultTable)
|
||||
globalSetting.ConfigFilePath = util.LookupEnvOrString(util.ConfigFilePathEnvVar, util.DefaultConfigFilePath)
|
||||
globalSetting.UpdatedAt = time.Now().UTC()
|
||||
o.conn.Write("server", "global_settings", globalSetting)
|
||||
|
|
|
@ -61,6 +61,12 @@ Global Settings
|
|||
name="forward_mark" placeholder="Forward Mark"
|
||||
value="{{ .globalSettings.ForwardMark }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Table">Table</label>
|
||||
<input type="text" class="form-control" id="table"
|
||||
name="table" placeholder="auto"
|
||||
value="{{ .globalSettings.Table }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="config_file_path">Wireguard Config File Path</label>
|
||||
<input type="text" class="form-control" id="config_file_path"
|
||||
|
@ -102,7 +108,9 @@ Global Settings
|
|||
<dd>Leave blank to omit this setting in the Client config.</dd>
|
||||
<dt>5. Forward Mark</dt>
|
||||
<dd>Set an <code>fwmark</code> on all packets going out of WireGuard's UDP socket. Default value: <code>0xca6c</code></dd>
|
||||
<dt>6. Wireguard Config File Path</dt>
|
||||
<dt>6. Table</dt>
|
||||
<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>
|
||||
<dd>The path of your Wireguard server config file. Please make sure the parent directory
|
||||
exists and is writable.</dd>
|
||||
</dl>
|
||||
|
@ -150,8 +158,9 @@ Global Settings
|
|||
const mtu = $("#mtu").val();
|
||||
const persistent_keepalive = $("#persistent_keepalive").val();
|
||||
const forward_mark = $("#forward_mark").val();
|
||||
const table = $("#table").val();
|
||||
const config_file_path = $("#config_file_path").val();
|
||||
const data = {"endpoint_address": endpoint_address, "dns_servers": dns_servers, "mtu": mtu, "persistent_keepalive": persistent_keepalive, "forward_mark": forward_mark, "config_file_path": config_file_path};
|
||||
const data = {"endpoint_address": endpoint_address, "dns_servers": dns_servers, "mtu": mtu, "persistent_keepalive": persistent_keepalive, "forward_mark": forward_mark, "table": table, "config_file_path": config_file_path};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
@ -224,6 +233,9 @@ Global Settings
|
|||
},
|
||||
forward_mark: {
|
||||
required: false
|
||||
},
|
||||
table: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
|
|
|
@ -10,6 +10,7 @@ PrivateKey = {{ .serverConfig.KeyPair.PrivateKey }}
|
|||
{{if .globalSettings.MTU}}MTU = {{ .globalSettings.MTU }}{{end}}
|
||||
PostUp = {{ .serverConfig.Interface.PostUp }}
|
||||
PostDown = {{ .serverConfig.Interface.PostDown }}
|
||||
Table = {{ .globalSettings.Table }}
|
||||
|
||||
{{range .clientDataList}}{{if eq .Client.Enabled true}}
|
||||
# ID: {{ .Client.ID }}
|
||||
|
|
|
@ -30,6 +30,7 @@ const (
|
|||
DefaultMTU = 1450
|
||||
DefaultPersistentKeepalive = 15
|
||||
DefaultForwardMark = "0xca6c"
|
||||
DefaultTable = "auto"
|
||||
DefaultConfigFilePath = "/etc/wireguard/wg0.conf"
|
||||
UsernameEnvVar = "WGUI_USERNAME"
|
||||
PasswordEnvVar = "WGUI_PASSWORD"
|
||||
|
@ -39,6 +40,7 @@ const (
|
|||
MTUEnvVar = "WGUI_MTU"
|
||||
PersistentKeepaliveEnvVar = "WGUI_PERSISTENT_KEEPALIVE"
|
||||
ForwardMarkEnvVar = "WGUI_FORWARD_MARK"
|
||||
TableEnvVar = "WGUI_TABLE"
|
||||
ConfigFilePathEnvVar = "WGUI_CONFIG_FILE_PATH"
|
||||
ServerAddressesEnvVar = "WGUI_SERVER_INTERFACE_ADDRESSES"
|
||||
ServerListenPortEnvVar = "WGUI_SERVER_LISTEN_PORT"
|
||||
|
|
Loading…
Add table
Reference in a new issue