From 41c804b179dee22b2b64342372d221476f6dbb6a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 20 Dec 2020 10:10:29 -0800 Subject: [PATCH] fix: update to minio/pkg/console changes (#3545) --- cmd/client-s3-trace_v2.go | 4 ++-- cmd/client-s3-trace_v4.go | 4 ++-- cmd/globals.go | 5 ----- cmd/utils.go | 22 ++++++++++++---------- go.mod | 4 ++-- go.sum | 8 ++++---- 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/cmd/client-s3-trace_v2.go b/cmd/client-s3-trace_v2.go index 093a3d92..fb6bdf8d 100644 --- a/cmd/client-s3-trace_v2.go +++ b/cmd/client-s3-trace_v2.go @@ -71,8 +71,8 @@ func (t traceV2) Response(resp *http.Response) (err error) { console.Debug(string(respTrace)) } - if globalInsecure && resp.TLS != nil { - dumpTLSCertificates(resp.TLS) + if resp.TLS != nil { + printTLSCertInfo(resp.TLS) } return err diff --git a/cmd/client-s3-trace_v4.go b/cmd/client-s3-trace_v4.go index 3f88721f..0d1eea26 100644 --- a/cmd/client-s3-trace_v4.go +++ b/cmd/client-s3-trace_v4.go @@ -86,8 +86,8 @@ func (t traceV4) Response(resp *http.Response) (err error) { console.Debug(string(respTrace)) } - if globalInsecure && resp.TLS != nil { - dumpTLSCertificates(resp.TLS) + if resp.TLS != nil { + printTLSCertInfo(resp.TLS) } return err diff --git a/cmd/globals.go b/cmd/globals.go index 143ce3f2..2066e8c2 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -70,11 +70,6 @@ func setGlobals(quiet, debug, json, noColor, insecure bool) { globalNoColor = globalNoColor || noColor globalInsecure = globalInsecure || insecure - // Enable debug messages if requested. - if globalDebug { - console.DebugPrint = true - } - // Disable colorified messages if requested. if globalNoColor || globalQuiet { console.SetColorOff() diff --git a/cmd/utils.go b/cmd/utils.go index fc272229..0818e121 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -102,18 +102,20 @@ func randString(n int, src rand.Source, prefix string) string { return prefix + string(b[0:30-len(prefix)]) } -// dumpTlsCertificates prints some fields of the certificates received from the server. +// printTLSCertInfo prints some fields of the certificates received from the server. // Fields will be inspected by the user, so they must be conscise and useful -func dumpTLSCertificates(t *tls.ConnectionState) { - for _, cert := range t.PeerCertificates { - console.Debugln("TLS Certificate found: ") - if len(cert.Issuer.Country) > 0 { - console.Debugln(" >> Country: " + cert.Issuer.Country[0]) +func printTLSCertInfo(t *tls.ConnectionState) { + if globalDebug { + for _, cert := range t.PeerCertificates { + console.Debugln("TLS Certificate found: ") + if len(cert.Issuer.Country) > 0 { + console.Debugln(" >> Country: " + cert.Issuer.Country[0]) + } + if len(cert.Issuer.Organization) > 0 { + console.Debugln(" >> Organization: " + cert.Issuer.Organization[0]) + } + console.Debugln(" >> Expires: " + cert.NotAfter.String()) } - if len(cert.Issuer.Organization) > 0 { - console.Debugln(" >> Organization: " + cert.Issuer.Organization[0]) - } - console.Debugln(" >> Expires: " + cert.NotAfter.String()) } } diff --git a/go.mod b/go.mod index 6d30ebff..bf33df10 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-runewidth v0.0.9 // indirect github.com/minio/cli v1.22.0 - github.com/minio/minio v0.0.0-20201217022412-970ddb424b7d - github.com/minio/minio-go/v7 v7.0.6 + github.com/minio/minio v0.0.0-20201219173637-3e16ec457a24 + github.com/minio/minio-go/v7 v7.0.7-0.20201217170524-3baf9ea06f7c github.com/minio/sha256-simd v0.1.1 github.com/mitchellh/go-homedir v1.1.0 github.com/pkg/profile v1.3.0 diff --git a/go.sum b/go.sum index 210a01d5..3d129812 100644 --- a/go.sum +++ b/go.sum @@ -364,10 +364,10 @@ github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2 github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= -github.com/minio/minio v0.0.0-20201217022412-970ddb424b7d h1:adgAHMjTf6ecUKNMxRQbd0+5N/AibcPe44l1GVJ7riA= -github.com/minio/minio v0.0.0-20201217022412-970ddb424b7d/go.mod h1:EYEA7s0k4DW2FU1DXFzV8wz6lJ+njjwOqDjpb4q7egg= -github.com/minio/minio-go/v7 v7.0.6 h1:9czXaG0LEZ9s74smSqy0rm034MxngQoP6HTTuSc5GEs= -github.com/minio/minio-go/v7 v7.0.6/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= +github.com/minio/minio v0.0.0-20201219173637-3e16ec457a24 h1:/evfBonJRJ+30RXVnxVIzzP0puZ0l3Zh9s3+6R/RskY= +github.com/minio/minio v0.0.0-20201219173637-3e16ec457a24/go.mod h1:sIgZV5KcIpn3bitFPXbrx/OyGcca57QzrgxT5I8nabg= +github.com/minio/minio-go/v7 v7.0.7-0.20201217170524-3baf9ea06f7c h1:NgTbI1w/B+2Jcl+YKTULAAXqkwWqMZbkzmVdWNwzKnA= +github.com/minio/minio-go/v7 v7.0.7-0.20201217170524-3baf9ea06f7c/go.mod h1:pEZBUa+L2m9oECoIA6IcSK8bv/qggtQVLovjeKK5jYc= github.com/minio/selfupdate v0.3.1 h1:BWEFSNnrZVMUWXbXIgLDNDjbejkmpAmZvy/nCz1HlEs= github.com/minio/selfupdate v0.3.1/go.mod h1:b8ThJzzH7u2MkF6PcIra7KaXO9Khf6alWPvMSyTDCFM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=