mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-28 15:14:34 +08:00
trim extra spaces from iface name mac
This commit is contained in:
parent
9e03510323
commit
aabb573a19
1 changed files with 4 additions and 1 deletions
|
|
@ -2,6 +2,8 @@ package wireguard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gravitl/netmaker/netclient/ncutils"
|
"github.com/gravitl/netmaker/netclient/ncutils"
|
||||||
)
|
)
|
||||||
|
|
@ -17,7 +19,8 @@ func GetRealIface(iface string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if !(ncutils.FileExists("/var/run/wireguard/" + realIfaceName + ".sock")) {
|
realIfaceName = strings.TrimSpace(realIfaceName)
|
||||||
|
if !(ncutils.FileExists(fmt.Sprintf("/var/run/wireguard/%s.sock", realIfaceName))) {
|
||||||
return "", errors.New("interface file does not exist")
|
return "", errors.New("interface file does not exist")
|
||||||
}
|
}
|
||||||
return realIfaceName, nil
|
return realIfaceName, nil
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue