cmd/tailscale: fix "tailscale ip $self-host-hostname"

And in the process, fix the related confusing error messages from
pinging your own IP or hostname.

Fixes #2803

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-09-07 11:57:23 -07:00
parent 4917a96aec
commit 7bfd4f521d
6 changed files with 59 additions and 22 deletions

View File

@@ -91,7 +91,7 @@ func runCp(ctx context.Context, args []string) error {
} else if hadBrackets && (err != nil || !ip.Is6()) {
return errors.New("unexpected brackets around target")
}
ip, err := tailscaleIPFromArg(ctx, target)
ip, _, err := tailscaleIPFromArg(ctx, target)
if err != nil {
return err
}