commit b03e42ce9c1de0521f0b098fe8809568faf7e19d Author: David Fifield david@bamsoftware.com Date: Sun Nov 11 19:54:40 2012 -0800
Add a --socks option to override port auto-selection. --- websocket-transport/websocket-client.go | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/websocket-transport/websocket-client.go b/websocket-transport/websocket-client.go index fcb9767..7205517 100644 --- a/websocket-transport/websocket-client.go +++ b/websocket-transport/websocket-client.go @@ -2,6 +2,7 @@ package main
import ( "code.google.com/p/go.net/websocket" + "flag" "fmt" "io" "net" @@ -164,7 +165,16 @@ func startListener(addrStr string) (*net.TCPListener, error) {
func main() { const ptMethodName = "websocket" - var socksAddrStrs = [...]string{"127.0.0.1:0", "[::1]:0"} + var defaultSocksAddrStrs = []string{"127.0.0.1:0", "[::1]:0"} + var socksAddrStrs []string + + var socksArg = flag.String("socks", "", "address on which to listen for SOCKS connections") + flag.Parse() + if *socksArg != "" { + socksAddrStrs = []string{*socksArg} + } else { + socksAddrStrs = defaultSocksAddrStrs + }
ptClientSetup([]string{ptMethodName})