From e9357d83e242f77ba0b18322ecc91020dd7ec743 Mon Sep 17 00:00:00 2001 From: andycandy-de <68217449+andycandy-de@users.noreply.github.com> Date: Wed, 24 May 2023 10:06:05 +0000 Subject: [PATCH] Added Table to global settings (#308) --- README.md | 1 + model/setting.go | 1 + store/jsondb/jsondb.go | 1 + templates/global_settings.html | 16 ++++++++++++++-- templates/wg.conf | 1 + util/config.go | 2 ++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62eef0d..cfa9d51 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ docker-compose up | `WGUI_MTU` | The default MTU used in global settings | `1450` | | `WGUI_PERSISTENT_KEEPALIVE` | The default persistent keepalive for WireGuard in global settings | `15` | | `WGUI_FIREWALL_MARK` | The default WireGuard firewall mark | `0xca6c` (51820) | +| `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` | | `WGUI_LOG_LEVEL` | The default log level. Possible values: `DEBUG`, `INFO`, `WARN`, `ERROR`, `OFF` | `INFO` | | `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 | diff --git a/model/setting.go b/model/setting.go index a702293..c9e152c 100644 --- a/model/setting.go +++ b/model/setting.go @@ -11,6 +11,7 @@ type GlobalSetting struct { MTU int `json:"mtu,string"` PersistentKeepalive int `json:"persistent_keepalive,string"` FirewallMark string `json:"firewall_mark"` + Table string `json:"table"` ConfigFilePath string `json:"config_file_path"` UpdatedAt time.Time `json:"updated_at"` } diff --git a/store/jsondb/jsondb.go b/store/jsondb/jsondb.go index f95ff16..cb831ca 100644 --- a/store/jsondb/jsondb.go +++ b/store/jsondb/jsondb.go @@ -102,6 +102,7 @@ func (o *JsonDB) Init() error { globalSetting.MTU = util.LookupEnvOrInt(util.MTUEnvVar, util.DefaultMTU) globalSetting.PersistentKeepalive = util.LookupEnvOrInt(util.PersistentKeepaliveEnvVar, util.DefaultPersistentKeepalive) globalSetting.FirewallMark = util.LookupEnvOrString(util.FirewallMarkEnvVar, util.DefaultFirewallMark) + 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) diff --git a/templates/global_settings.html b/templates/global_settings.html index 15d7b4b..cafb630 100644 --- a/templates/global_settings.html +++ b/templates/global_settings.html @@ -61,6 +61,12 @@ Global Settings name="firewall_mark" placeholder="Firewall Mark" value="{{ .globalSettings.FirewallMark }}"> +
fwmark
on all packets going out of a WireGuard non-default-route tunnel. Default value: 0xca6c
Table
setting in the wg conf file. Default value: auto