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

Method ConnectedUrl

nats.go:2502–2514  ·  view source on GitHub ↗

ConnectedUrl reports the connected server's URL

()

Source from the content-addressed store, hash-verified

2500
2501// ConnectedUrl reports the connected server's URL
2502func (nc *Conn) ConnectedUrl() string {
2503 if nc == nil {
2504 return _EMPTY_
2505 }
2506
2507 nc.mu.RLock()
2508 defer nc.mu.RUnlock()
2509
2510 if nc.status != CONNECTED {
2511 return _EMPTY_
2512 }
2513 return nc.current.URL.String()
2514}
2515
2516// ConnectedUrlRedacted reports the connected server's URL with passwords redacted
2517func (nc *Conn) ConnectedUrlRedacted() string {

Callers 15

TestSetServerPoolFunction · 0.80
TestConnectedServerFunction · 0.80
TestServersOptionFunction · 0.80
TestAuthServersFunction · 0.80
TestHotSpotReconnectFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 13

TestSetServerPoolFunction · 0.64
TestConnectedServerFunction · 0.64
TestServersOptionFunction · 0.64
TestAuthServersFunction · 0.64
TestHotSpotReconnectFunction · 0.64