mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-26 05:56:36 +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 (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gravitl/netmaker/netclient/ncutils"
|
||||
)
|
||||
|
|
@ -17,7 +19,8 @@ func GetRealIface(iface string) (string, error) {
|
|||
if err != nil {
|
||||
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 realIfaceName, nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue