Skip to content

Commit 0097e94

Browse files
committed
-h flag to specify ip host to listen on.
Handy for running locally without worrying about the server getting exposed.
1 parent fe2ac76 commit 0097e94

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

execd.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/flynn/go-shlex"
2323
)
2424

25+
var host = flag.String("h", "", "host ip to listen on")
2526
var port = flag.String("p", "22", "port to listen on")
2627
var debug = flag.Bool("d", false, "debug mode displays handler output")
2728
var env = flag.Bool("e", false, "pass environment to handlers")
@@ -206,7 +207,7 @@ func main() {
206207
if p := os.Getenv("PORT"); p != "" && *port == "22" {
207208
*port = p
208209
}
209-
listener, err := net.Listen("tcp", ":"+*port)
210+
listener, err := net.Listen("tcp", *host+":"+*port)
210211
if err != nil {
211212
log.Fatalln("Failed to listen for connections:", err)
212213
}

0 commit comments

Comments
 (0)