fixing client issues for uspace, fwmark, vpn

This commit is contained in:
afeiszli
2021-11-29 04:34:11 -05:00
parent 07b2055abf
commit 801919ab0d
14 changed files with 122 additions and 41 deletions

View File

@@ -47,7 +47,7 @@ func RemoveConf(iface string, printlog bool) error {
// Private Functions
func initWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig, hasGateway bool, gateways []string, fwmark int32) error {
func initWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig, hasGateway bool, gateways []string) error {
key, err := wgtypes.ParseKey(privkey)
if err != nil {
@@ -85,7 +85,7 @@ func initWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
if !ncutils.IsKernel() {
var newConf string
newConf, _ = ncutils.CreateUserSpaceConf(node.Address, key.String(), strconv.FormatInt(int64(node.ListenPort), 10), node.MTU, fwmark, node.PersistentKeepalive, peers)
newConf, _ = ncutils.CreateUserSpaceConf(node.Address, key.String(), strconv.FormatInt(int64(node.ListenPort), 10), node.MTU, node.PersistentKeepalive, peers)
confPath := ncutils.GetNetclientPathSpecific() + ifacename + ".conf"
Log("writing wg conf file to: "+confPath, 1)
err = ioutil.WriteFile(confPath, []byte(newConf), 0644)
@@ -293,7 +293,7 @@ func setWGConfig(node models.Node, network string, peerupdate bool) error {
err = setServerPeers(iface, node.PersistentKeepalive, peers)
Log("updated peers on server "+node.Name, 2)
} else {
err = initWireguard(&node, privkey, peers, hasGateway, gateways, 0)
err = initWireguard(&node, privkey, peers, hasGateway, gateways)
Log("finished setting wg config on server "+node.Name, 3)
}
return err