From 66f2d41c6bd0763a558c6935fa312a4433077fac Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 21 Jun 2021 23:05:27 -0600 Subject: [PATCH] -q => -s (to be curl-like), make staticcheck happy --- cmd/sclient/main.go | 6 +++--- sclient.go | 8 ++++---- staticcheck.conf | 11 +++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 staticcheck.conf diff --git a/cmd/sclient/main.go b/cmd/sclient/main.go index 9666c1b..c88971f 100644 --- a/cmd/sclient/main.go +++ b/cmd/sclient/main.go @@ -47,10 +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") + silent := flag.Bool("s", false, "alias of --silent") 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.BoolVar(silent, "silent", false, "less verbose output") flag.Parse() remotestr := flag.Arg(0) localstr := flag.Arg(1) @@ -71,7 +71,7 @@ func main() { LocalAddress: "localhost", InsecureSkipVerify: *insecure, ServerName: *servername, - Quiet: *quiet, + Silent: *silent, } remote := strings.Split(remotestr, ":") diff --git a/sclient.go b/sclient.go index df0e9c9..2631546 100644 --- a/sclient.go +++ b/sclient.go @@ -18,7 +18,7 @@ type Tunnel struct { LocalPort int InsecureSkipVerify bool ServerName string - Quiet bool + Silent bool } // DialAndListen will create a test TLS connection to the remote address and then @@ -46,7 +46,7 @@ func (t *Tunnel) DialAndListen() error { } else { name = "stdin" } - conn := &stdnet{os.Stdin, os.Stdout, &stdaddr{net.UnixAddr{name, network}}} + conn := &stdnet{os.Stdin, os.Stdout, &stdaddr{net.UnixAddr{Name: name, Net: network}}} t.handleConnection(remote, conn) return nil } @@ -111,7 +111,7 @@ func pipe(r netReadWriteCloser, w netReadWriteCloser, t string) { if nil != err { //fmt.Fprintf(os.Stdout, "[debug] (%s:%d) error reading %s\n", t, count, err) if io.EOF != err { - fmt.Fprintf(os.Stderr, "[read error] (%s:%s) %s\n", t, count, err) + fmt.Fprintf(os.Stderr, "[read error] (%s:%d) %s\n", t, count, err) } r.Close() //w.Close() @@ -151,7 +151,7 @@ func (t *Tunnel) handleConnection(remote string, conn netReadWriteCloser) { } if "stdio" == conn.RemoteAddr().Network() { - if t.Quiet == false { + if !t.Silent { fmt.Fprintf(os.Stdout, "(connected to %s:%d and reading from %s)\n", t.RemoteAddress, t.RemotePort, conn.RemoteAddr().String()) } diff --git a/staticcheck.conf b/staticcheck.conf new file mode 100644 index 0000000..0f2b03e --- /dev/null +++ b/staticcheck.conf @@ -0,0 +1,11 @@ +# I like my yoda conditions ST1017 +checks = ["all", "-ST1017", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023"] +initialisms = ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", + "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", + "IP", "JSON", "QPS", "RAM", "RPC", "SLA", + "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", + "UDP", "UI", "GID", "UID", "UUID", "URI", + "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", + "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] +dot_import_whitelist = [] +http_status_code_whitelist = ["200", "400", "404", "500"]