From fc6fed82929a413be0c5ea7259e93ae3d105300c Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Fri, 5 Jun 2020 17:21:46 -0700 Subject: [PATCH] Prep for mixed mode Signed-off-by: Derek Collison --- nats.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nats.go b/nats.go index 4184ada94..daa56fdb7 100644 --- a/nats.go +++ b/nats.go @@ -568,6 +568,7 @@ type serverInfo struct { Version string `json:"version"` AuthRequired bool `json:"auth_required"` TLSRequired bool `json:"tls_required"` + TLSAvailable bool `json:"tls_available"` Headers bool `json:"headers"` MaxPayload int64 `json:"max_payload"` ConnectURLs []string `json:"connect_urls,omitempty"` @@ -1601,7 +1602,7 @@ func (nc *Conn) checkForSecure() error { o := nc.Opts // Check for mismatch in setups - if o.Secure && !nc.info.TLSRequired { + if o.Secure && !nc.info.TLSRequired && !nc.info.TLSAvailable { return ErrSecureConnWanted } else if nc.info.TLSRequired && !o.Secure { // Switch to Secure since server needs TLS.