Add ForwardMark to global settings

This commit is contained in:
Frank Ittermann 2022-03-21 21:50:00 +01:00
parent ad4ca4d9bb
commit f6720d2723
No known key found for this signature in database
GPG key ID: A9215275A11EAAC6
5 changed files with 21 additions and 2 deletions

View file

@ -26,6 +26,7 @@ const (
DefaultDNS = "1.1.1.1"
DefaultMTU = 1450
DefaultPersistentKeepalive = 15
DefaultForwardMark = "0xca6c"
DefaultConfigFilePath = "/etc/wireguard/wg0.conf"
UsernameEnvVar = "WGUI_USERNAME"
PasswordEnvVar = "WGUI_PASSWORD"

View file

@ -55,11 +55,17 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
peerPersistentKeepalive = fmt.Sprintf("PersistentKeepalive = %d\n", setting.PersistentKeepalive)
}
forwardMark := ""
if setting.ForwardMark != DefaultForwardMark {
forwardMark = fmt.Sprintf("FwMark = %s\n", setting.ForwardMark)
}
// build the config as string
strConfig := "[Interface]\n" +
clientAddress +
clientPrivateKey +
clientDNS +
forwardMark +
"\n[Peer]\n" +
peerPublicKey +
peerPresharedKey +