From c8ca9fc372b78484544bc96c787b0f484cf7c749 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Sun, 16 Jun 2019 20:24:46 +1000 Subject: [PATCH 1/3] update --bind flag help text Clarify how to specify --bind without a host by providing the syntax for it. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index bc0de4a..51433aa 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,7 @@ func (c *rootCmd) RegisterFlags(fl *flag.FlagSet) { fl.BoolVar(&c.skipSync, "skipsync", false, "skip syncing local settings and extensions to remote host") fl.BoolVar(&c.syncBack, "b", false, "sync extensions back on termination") fl.BoolVar(&c.printVersion, "version", false, "print version information and exit") - fl.StringVar(&c.bindAddr, "bind", "", "local bind address for ssh tunnel") + fl.StringVar(&c.bindAddr, "bind", "", `local bind address for ssh tunnel, in [HOST]:PORT syntax (default: 127.0.0.1)`) fl.StringVar(&c.sshFlags, "ssh-flags", "", "custom SSH flags") } From 65655b960ed1f04aa241f17de45965e8506f3df1 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Sun, 16 Jun 2019 20:28:41 +1000 Subject: [PATCH 2/3] undo changing quotes to backticks --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 51433aa..0d16036 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,7 @@ func (c *rootCmd) RegisterFlags(fl *flag.FlagSet) { fl.BoolVar(&c.skipSync, "skipsync", false, "skip syncing local settings and extensions to remote host") fl.BoolVar(&c.syncBack, "b", false, "sync extensions back on termination") fl.BoolVar(&c.printVersion, "version", false, "print version information and exit") - fl.StringVar(&c.bindAddr, "bind", "", `local bind address for ssh tunnel, in [HOST]:PORT syntax (default: 127.0.0.1)`) + fl.StringVar(&c.bindAddr, "bind", "", "local bind address for ssh tunnel, in [HOST]:PORT syntax (default: 127.0.0.1)") fl.StringVar(&c.sshFlags, "ssh-flags", "", "custom SSH flags") } From 0b43319a1239a71532e94d3747006dc676fddd97 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Thu, 27 Jun 2019 14:15:24 +1000 Subject: [PATCH 3/3] make :PORT optional in parseBindAddr --- main.go | 2 +- sshcode.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 0d16036..f637438 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,7 @@ func (c *rootCmd) RegisterFlags(fl *flag.FlagSet) { fl.BoolVar(&c.skipSync, "skipsync", false, "skip syncing local settings and extensions to remote host") fl.BoolVar(&c.syncBack, "b", false, "sync extensions back on termination") fl.BoolVar(&c.printVersion, "version", false, "print version information and exit") - fl.StringVar(&c.bindAddr, "bind", "", "local bind address for ssh tunnel, in [HOST]:PORT syntax (default: 127.0.0.1)") + fl.StringVar(&c.bindAddr, "bind", "", "local bind address for SSH tunnel, in [HOST][:PORT] syntax (default: 127.0.0.1)") fl.StringVar(&c.sshFlags, "ssh-flags", "", "custom SSH flags") } diff --git a/sshcode.go b/sshcode.go index 97e7502..c43f0f7 100644 --- a/sshcode.go +++ b/sshcode.go @@ -168,8 +168,8 @@ func sshCode(host, dir string, o options) error { } func parseBindAddr(bindAddr string) (string, error) { - if bindAddr == "" { - bindAddr = ":" + if !strings.Contains(bindAddr, ":") { + bindAddr += ":" } host, port, err := net.SplitHostPort(bindAddr)