aboutsummaryrefslogtreecommitdiffstats
path: root/handshake.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-04-11 16:44:21 -0400
committerSam Anthony <sam@samanthony.xyz>2025-04-11 16:44:21 -0400
commit034f278a561be5f493bad3c34e3e853db8550ee8 (patch)
treef0180d8f60d6f03a7e10116e7ea8409df8d2c9eb /handshake.go
parent41cacdff65ea17a2e33068bc59036ec2fe519145 (diff)
downloadhose-034f278a561be5f493bad3c34e3e853db8550ee8.zip
show valid responses when verifying key
Diffstat (limited to 'handshake.go')
-rw-r--r--handshake.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/handshake.go b/handshake.go
index 68fbedb..d408e1f 100644
--- a/handshake.go
+++ b/handshake.go
@@ -9,6 +9,7 @@ import (
"net"
"os"
"slices"
+ "strings"
"git.samanthony.xyz/hose/hosts"
"git.samanthony.xyz/hose/key"
@@ -142,13 +143,14 @@ func scan(responses []string) (string, error) {
if err := scanner.Err(); err != nil {
return "", err
}
- response := scanner.Text()
+ response := strings.TrimSpace(scanner.Text())
for !slices.Contains(responses, response) {
+ util.Logf("Please enter one of %q", responses)
scanner.Scan()
if err := scanner.Err(); err != nil {
return "", err
}
- response = scanner.Text()
+ response = strings.TrimSpace(scanner.Text())
}
return response, nil
}