MCPcopy
hub / github.com/nats-io/nats.go / TLSConnectionState

Method TLSConnectionState

nats.go:2427–2442  ·  view source on GitHub ↗

TLSConnectionState retrieves the state of the TLS connection to the server

()

Source from the content-addressed store, hash-verified

2425
2426// TLSConnectionState retrieves the state of the TLS connection to the server
2427func (nc *Conn) TLSConnectionState() (tls.ConnectionState, error) {
2428 if !nc.isConnected() {
2429 return tls.ConnectionState{}, ErrDisconnected
2430 }
2431
2432 nc.mu.RLock()
2433 conn := nc.conn
2434 nc.mu.RUnlock()
2435
2436 tc, ok := conn.(*tls.Conn)
2437 if !ok {
2438 return tls.ConnectionState{}, ErrConnectionNotTLS
2439 }
2440
2441 return tc.ConnectionState(), nil
2442}
2443
2444// waitForExits will wait for all socket watcher Go routines to
2445// be shutdown before proceeding.

Callers 3

TestTLSHandshakeFirstFunction · 0.80

Calls 1

isConnectedMethod · 0.95

Tested by 3

TestTLSHandshakeFirstFunction · 0.64