Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit 0b43319

Browse files
committed
make :PORT optional in parseBindAddr
1 parent 65655b9 commit 0b43319

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (c *rootCmd) RegisterFlags(fl *flag.FlagSet) {
5353
fl.BoolVar(&c.skipSync, "skipsync", false, "skip syncing local settings and extensions to remote host")
5454
fl.BoolVar(&c.syncBack, "b", false, "sync extensions back on termination")
5555
fl.BoolVar(&c.printVersion, "version", false, "print version information and exit")
56-
fl.StringVar(&c.bindAddr, "bind", "", "local bind address for ssh tunnel, in [HOST]:PORT syntax (default: 127.0.0.1)")
56+
fl.StringVar(&c.bindAddr, "bind", "", "local bind address for SSH tunnel, in [HOST][:PORT] syntax (default: 127.0.0.1)")
5757
fl.StringVar(&c.sshFlags, "ssh-flags", "", "custom SSH flags")
5858
}
5959

sshcode.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ func sshCode(host, dir string, o options) error {
168168
}
169169

170170
func parseBindAddr(bindAddr string) (string, error) {
171-
if bindAddr == "" {
172-
bindAddr = ":"
171+
if !strings.Contains(bindAddr, ":") {
172+
bindAddr += ":"
173173
}
174174

175175
host, port, err := net.SplitHostPort(bindAddr)

0 commit comments

Comments
 (0)