From 828e1b79dabf61adfeac0cab81b8578c63f91903 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Sat, 6 Aug 2016 20:41:44 -0700 Subject: [PATCH] don't try to SplitHostPort when the target garden is on a unix socket --- commands/net_in.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/commands/net_in.go b/commands/net_in.go index d140fed..be02baa 100644 --- a/commands/net_in.go +++ b/commands/net_in.go @@ -3,6 +3,7 @@ package commands import ( "fmt" "net" + "os" ) type NetIn struct { @@ -16,8 +17,13 @@ func (command *NetIn) Execute(maybeHandle []string) error { hostPort, _, err := container.NetIn(0, uint32(command.Port)) failIf(err) - host, _, err := net.SplitHostPort(Globals.Target.Address) - failIf(err) + host := Globals.Target.Address + if _, err := os.Stat(host); err == nil { + host = "127.0.0.1" + } else { + host, _, err = net.SplitHostPort(host) + failIf(err) + } fmt.Println(net.JoinHostPort(host, fmt.Sprintf("%d", hostPort)))