diff --git a/cmd/sclient/main.go b/cmd/sclient/main.go index 1f1d780..9666c1b 100644 --- a/cmd/sclient/main.go +++ b/cmd/sclient/main.go @@ -47,8 +47,10 @@ func main() { flag.Usage = usage insecure := flag.Bool("k", false, "ignore bad TLS/SSL/HTTPS certificates") + quiet := flag.Bool("q", false, "don't output connection established messages") servername := flag.String("servername", "", "specify a servername different from (to disable SNI use an IP as and do use this option)") flag.BoolVar(insecure, "insecure", false, "ignore bad TLS/SSL/HTTPS certificates") + flag.BoolVar(quiet, "quiet", false, "don't output connection established messages") flag.Parse() remotestr := flag.Arg(0) localstr := flag.Arg(1) @@ -69,6 +71,7 @@ func main() { LocalAddress: "localhost", InsecureSkipVerify: *insecure, ServerName: *servername, + Quiet: *quiet, } remote := strings.Split(remotestr, ":") diff --git a/sclient.go b/sclient.go index 7cb3296..df0e9c9 100644 --- a/sclient.go +++ b/sclient.go @@ -18,6 +18,7 @@ type Tunnel struct { LocalPort int InsecureSkipVerify bool ServerName string + Quiet bool } // DialAndListen will create a test TLS connection to the remote address and then @@ -150,8 +151,10 @@ func (t *Tunnel) handleConnection(remote string, conn netReadWriteCloser) { } if "stdio" == conn.RemoteAddr().Network() { - fmt.Fprintf(os.Stdout, "(connected to %s:%d and reading from %s)\n", - t.RemoteAddress, t.RemotePort, conn.RemoteAddr().String()) + if t.Quiet == false { + fmt.Fprintf(os.Stdout, "(connected to %s:%d and reading from %s)\n", + t.RemoteAddress, t.RemotePort, conn.RemoteAddr().String()) + } } else { fmt.Fprintf(os.Stdout, "[connect] %s => %s:%d\n", strings.Replace(conn.RemoteAddr().String(), "[::1]:", "localhost:", 1), t.RemoteAddress, t.RemotePort)