mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-17 02:24:23 +08:00
fix lookup for netclient wg config file
This commit is contained in:
parent
95dea6a4ba
commit
9c6a26dcc5
1 changed files with 3 additions and 2 deletions
|
@ -165,7 +165,7 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
|
|||
// return err
|
||||
//}
|
||||
//if ncutils.IsWindows() {
|
||||
confPath := ncutils.GetWGPathSpecific() + ifacename + ".conf"
|
||||
confPath := ncutils.GetNetclientPathSpecific() + ifacename + ".conf"
|
||||
// err = os.WriteFile(wgConfPath, []byte(newConf), 0644)
|
||||
// if err != nil {
|
||||
// ncutils.PrintLog("error writing wg conf file to "+wgConfPath+": "+err.Error(), 1)
|
||||
|
@ -333,7 +333,7 @@ func WriteWgConfig(node *models.Node, privateKey string, peers []wgtypes.PeerCon
|
|||
}
|
||||
for i, peer := range peers {
|
||||
wireguard.SectionWithIndex(section_peers, i).Key("PublicKey").SetValue(peer.PublicKey.String())
|
||||
if peer.PresharedKey.String() != "" {
|
||||
if peer.PresharedKey != nil {
|
||||
wireguard.SectionWithIndex(section_peers, i).Key("PreSharedKey").SetValue(peer.PresharedKey.String())
|
||||
}
|
||||
if peer.AllowedIPs != nil {
|
||||
|
@ -350,6 +350,7 @@ func WriteWgConfig(node *models.Node, privateKey string, peers []wgtypes.PeerCon
|
|||
if peer.Endpoint != nil {
|
||||
wireguard.SectionWithIndex(section_peers, i).Key("Endpoint").SetValue(peer.Endpoint.String())
|
||||
}
|
||||
|
||||
if peer.PersistentKeepaliveInterval != nil && peer.PersistentKeepaliveInterval.Seconds() > 0 {
|
||||
wireguard.SectionWithIndex(section_peers, i).Key("PersistentKeepalive").SetValue(strconv.FormatInt((int64)(peer.PersistentKeepaliveInterval.Seconds()), 10))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue