mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-08 02:06:06 +08:00
remove debugging logs and switch existing log.Println to logger.Log
This commit is contained in:
@@ -2,7 +2,6 @@ package wireguard
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -52,7 +51,7 @@ func SetPeers(iface string, node *models.Node, peers []wgtypes.PeerConfig) error
|
|||||||
currentPeer.PublicKey.String() != peer.PublicKey.String() {
|
currentPeer.PublicKey.String() != peer.PublicKey.String() {
|
||||||
_, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)
|
_, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("error removing peer", peer.Endpoint.String())
|
logger.Log(0, "error removing peer", peer.Endpoint.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +81,7 @@ func SetPeers(iface string, node *models.Node, peers []wgtypes.PeerConfig) error
|
|||||||
" allowed-ips "+allowedips, true)
|
" allowed-ips "+allowedips, true)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("error setting peer", peer.PublicKey.String())
|
logger.Log(0, "error setting peer", peer.PublicKey.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +103,7 @@ func SetPeers(iface string, node *models.Node, peers []wgtypes.PeerConfig) error
|
|||||||
if shouldDelete {
|
if shouldDelete {
|
||||||
output, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)
|
output, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(output, "error removing peer", currentPeer.PublicKey.String())
|
logger.Log(0, output, "error removing peer", currentPeer.PublicKey.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, ip := range currentPeer.AllowedIPs {
|
for _, ip := range currentPeer.AllowedIPs {
|
||||||
@@ -440,7 +439,6 @@ func UpdateWgPeers(file string, peers []wgtypes.PeerConfig) (*net.UDPAddr, error
|
|||||||
|
|
||||||
// UpdateWgInterface - updates the interface section of a wireguard config file
|
// UpdateWgInterface - updates the interface section of a wireguard config file
|
||||||
func UpdateWgInterface(file, privateKey, nameserver string, node models.Node) error {
|
func UpdateWgInterface(file, privateKey, nameserver string, node models.Node) error {
|
||||||
log.Println("updating conf file ", file, nameserver, node.Name)
|
|
||||||
options := ini.LoadOptions{
|
options := ini.LoadOptions{
|
||||||
AllowNonUniqueSections: true,
|
AllowNonUniqueSections: true,
|
||||||
AllowShadows: true,
|
AllowShadows: true,
|
||||||
@@ -467,7 +465,6 @@ func UpdateWgInterface(file, privateKey, nameserver string, node models.Node) er
|
|||||||
//}
|
//}
|
||||||
//need to split postup/postdown because ini lib adds a quotes which breaks freebsd
|
//need to split postup/postdown because ini lib adds a quotes which breaks freebsd
|
||||||
if node.PostUp != "" {
|
if node.PostUp != "" {
|
||||||
log.Println("updating PostUp")
|
|
||||||
parts := strings.Split(node.PostUp, " ; ")
|
parts := strings.Split(node.PostUp, " ; ")
|
||||||
for i, part := range parts {
|
for i, part := range parts {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
Reference in New Issue
Block a user