diff --git a/README.md b/README.md
index 0c7bebd..27b4ed8 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ docker-compose up
| `WGUI_DNS` | The default DNS servers (comma-separated-list) used in the global settings | `1.1.1.1` |
| `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_FIREWALL_MARK` | The default WireGuard firewall mark | `0xca6c` (51820) |
| `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 e871591..a702293 100644
--- a/model/setting.go
+++ b/model/setting.go
@@ -10,7 +10,7 @@ type GlobalSetting struct {
DNSServers []string `json:"dns_servers"`
MTU int `json:"mtu,string"`
PersistentKeepalive int `json:"persistent_keepalive,string"`
- ForwardMark string `json:"forward_mark"`
+ FirewallMark string `json:"firewall_mark"`
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 0357cbe..f95ff16 100644
--- a/store/jsondb/jsondb.go
+++ b/store/jsondb/jsondb.go
@@ -101,7 +101,7 @@ func (o *JsonDB) Init() error {
globalSetting.DNSServers = util.LookupEnvOrStrings(util.DNSEnvVar, []string{util.DefaultDNS})
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.FirewallMark = util.LookupEnvOrString(util.FirewallMarkEnvVar, util.DefaultFirewallMark)
globalSetting.ConfigFilePath = util.LookupEnvOrString(util.ConfigFilePathEnvVar, util.DefaultConfigFilePath)
globalSetting.UpdatedAt = time.Now().UTC()
o.conn.Write("server", "global_settings", globalSetting)
@@ -269,9 +269,6 @@ func (o *JsonDB) GetClientByID(clientID string, qrCodeSettings model.QRCodeSetti
if !qrCodeSettings.IncludeMTU {
globalSettings.MTU = 0
}
- if !qrCodeSettings.IncludeFwMark {
- globalSettings.ForwardMark = ""
- }
png, err := qrcode.Encode(util.BuildClientConfig(client, server, globalSettings), qrcode.Medium, 256)
if err == nil {
diff --git a/templates/clients.html b/templates/clients.html
index 5a585f0..513797c 100644
--- a/templates/clients.html
+++ b/templates/clients.html
@@ -70,17 +70,8 @@ Wireguard Clients
-
-
-
-
+
+
@@ -490,9 +481,7 @@ Wireguard Clients
cache: false,
method: 'GET',
url: '{{.basePath}}/api/client/' + client_id,
- data: {
- qrCodeIncludeFwMark: include_fwmark
- },
+ data: JSON.stringify(data),
dataType: 'json',
contentType: "application/json",
success: function (resp) {
diff --git a/templates/global_settings.html b/templates/global_settings.html
index 8a41d1f..15d7b4b 100644
--- a/templates/global_settings.html
+++ b/templates/global_settings.html
@@ -56,10 +56,10 @@ Global Settings
value="{{if .globalSettings.PersistentKeepalive }}{{ .globalSettings.PersistentKeepalive }}{{end}}">
- Forward Mark
-
+ Firewall Mark
+
Wireguard Config File Path
@@ -100,8 +100,8 @@ Global Settings
until they reach out to other peers themselves. Adding PersistentKeepalive
can ensure that the connection remains open.
Leave blank to omit this setting in the Client config.
- 5. Forward Mark
- Set an fwmark
on all packets going out of WireGuard's UDP socket. Default value: 0xca6c
+ 5. Firewall Mark
+ Add a matching fwmark
on all packets going out of a WireGuard non-default-route tunnel. Default value: 0xca6c
6. Wireguard Config File Path
The path of your Wireguard server config file. Please make sure the parent directory
exists and is writable.
@@ -149,9 +149,9 @@ Global Settings
const dns_servers = $("#dns_servers").val().split(",");
const mtu = $("#mtu").val();
const persistent_keepalive = $("#persistent_keepalive").val();
- const forward_mark = $("#forward_mark").val();
+ const firewall_mark = $("#firewall_mark").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, "firewall_mark": firewall_mark, "config_file_path": config_file_path};
$.ajax({
cache: false,
@@ -222,7 +222,7 @@ Global Settings
config_file_path: {
required: true
},
- forward_mark: {
+ firewall_mark: {
required: false
}
},
diff --git a/util/config.go b/util/config.go
index 018690f..7a95f97 100644
--- a/util/config.go
+++ b/util/config.go
@@ -30,7 +30,7 @@ const (
DefaultDNS = "1.1.1.1"
DefaultMTU = 1450
DefaultPersistentKeepalive = 15
- DefaultForwardMark = "0xca6c"
+ DefaultFirewallMark = "0xca6c" // i.e. 51820
DefaultConfigFilePath = "/etc/wireguard/wg0.conf"
UsernameEnvVar = "WGUI_USERNAME"
PasswordEnvVar = "WGUI_PASSWORD"
@@ -40,7 +40,7 @@ const (
DNSEnvVar = "WGUI_DNS"
MTUEnvVar = "WGUI_MTU"
PersistentKeepaliveEnvVar = "WGUI_PERSISTENT_KEEPALIVE"
- ForwardMarkEnvVar = "WGUI_FORWARD_MARK"
+ FirewallMarkEnvVar = "WGUI_FIREWALL_MARK"
ConfigFilePathEnvVar = "WGUI_CONFIG_FILE_PATH"
LogLevel = "WGUI_LOG_LEVEL"
ServerAddressesEnvVar = "WGUI_SERVER_INTERFACE_ADDRESSES"
diff --git a/util/util.go b/util/util.go
index 44f357b..04950f9 100644
--- a/util/util.go
+++ b/util/util.go
@@ -65,18 +65,12 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
peerPersistentKeepalive = fmt.Sprintf("PersistentKeepalive = %d\n", setting.PersistentKeepalive)
}
- forwardMark := ""
- if setting.ForwardMark != "" {
- forwardMark = fmt.Sprintf("FwMark = %s\n", setting.ForwardMark)
- }
-
// build the config as string
strConfig := "[Interface]\n" +
clientAddress +
clientPrivateKey +
clientDNS +
clientMTU +
- forwardMark +
"\n[Peer]\n" +
peerPublicKey +
peerPresharedKey +