mirror of
https://github.com/netbirdio/netbird.git
synced 2025-04-10 18:58:27 +02:00
fix: windows build
This commit is contained in:
parent
38e3c9c062
commit
2a97053cae
@ -17,7 +17,6 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -230,17 +229,16 @@ func loginPeer(serverPublicKey wgtypes.Key, client *mgm.Client) (*mgmProto.Login
|
|||||||
// promptPeerSetupKey prompts user to input a Setup Key
|
// promptPeerSetupKey prompts user to input a Setup Key
|
||||||
func promptPeerSetupKey() (*string, error) {
|
func promptPeerSetupKey() (*string, error) {
|
||||||
fmt.Print("Enter setup key: ")
|
fmt.Print("Enter setup key: ")
|
||||||
reader := bufio.NewReader(os.Stdin)
|
|
||||||
input, err := reader.ReadString('\n')
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
input = strings.TrimSuffix(input, "\n")
|
|
||||||
|
|
||||||
if input == "" {
|
s := bufio.NewScanner(os.Stdin)
|
||||||
fmt.Print("Specified key is empty, try again.")
|
for s.Scan() {
|
||||||
return promptPeerSetupKey()
|
input := s.Text()
|
||||||
|
if input != "" {
|
||||||
|
return &input, nil
|
||||||
|
}
|
||||||
|
fmt.Println("Specified key is empty, try again:")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &input, err
|
return nil, s.Err()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user