Add -quiet and -q flags
This commit is contained in:
parent
455db50928
commit
ca84ed48de
|
@ -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 <remote> (to disable SNI use an IP as <remote> 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, ":")
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue