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

Method ConnectedAddr

nats.go:2532–2544  ·  view source on GitHub ↗

ConnectedAddr returns the connected server's IP

()

Source from the content-addressed store, hash-verified

2530
2531// ConnectedAddr returns the connected server's IP
2532func (nc *Conn) ConnectedAddr() string {
2533 if nc == nil {
2534 return _EMPTY_
2535 }
2536
2537 nc.mu.RLock()
2538 defer nc.mu.RUnlock()
2539
2540 if nc.status != CONNECTED {
2541 return _EMPTY_
2542 }
2543 return nc.conn.RemoteAddr().String()
2544}
2545
2546// LocalAddr returns the local network address of the connection
2547func (nc *Conn) LocalAddr() string {

Callers 1

TestConnectedAddrFunction · 0.95

Calls 2

RemoteAddrMethod · 0.80
StringMethod · 0.45

Tested by 1

TestConnectedAddrFunction · 0.76