mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-29 16:34:25 +08:00
removing mac path formatting, adding comment
This commit is contained in:
parent
723e4ebeee
commit
0c0f089688
2 changed files with 5 additions and 4 deletions
|
@ -41,6 +41,7 @@ func setRoute(iface string, addr *net.IPNet, address string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// SetExplicitRoute - sets route via explicit ip address
|
||||
func SetExplicitRoute(iface string, destination *net.IPNet, gateway string) error {
|
||||
_, err := ncutils.RunCmd("route add "+destination.String()+" "+gateway, false)
|
||||
return err
|
||||
|
|
|
@ -209,8 +209,8 @@ func addRoute(addr string, iface string) error {
|
|||
// setConfig - sets configuration of the wireguard interface from the config file
|
||||
func setConfig(realIface string, confPath string) error {
|
||||
confString := getConfig(confPath)
|
||||
pathFormatted := strings.Replace(confPath, " ", "\\ ", -1)
|
||||
err := os.WriteFile(pathFormatted+".tmp", []byte(confString), 0600)
|
||||
// pathFormatted := strings.Replace(confPath, " ", "\\ ", -1)
|
||||
err := os.WriteFile(confPath+".tmp", []byte(confString), 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -221,9 +221,9 @@ func setConfig(realIface string, confPath string) error {
|
|||
|
||||
// getConfig - gets config from config file and strips out incompatible fields
|
||||
func getConfig(path string) string {
|
||||
pathFormatted := strings.Replace(path, " ", "\\ ", -1)
|
||||
// pathFormatted := strings.Replace(path, " ", "\\ ", -1)
|
||||
var confCmd = "grep -v -e Address -e MTU -e PostUp -e PostDown "
|
||||
confRaw, _ := ncutils.RunCmd(confCmd+pathFormatted, false)
|
||||
confRaw, _ := ncutils.RunCmd(confCmd+path, false)
|
||||
return confRaw
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue