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

Method getServers

nats.go:6212–6223  ·  view source on GitHub ↗

caller must lock

(implicitOnly bool)

Source from the content-addressed store, hash-verified

6210
6211// caller must lock
6212func (nc *Conn) getServers(implicitOnly bool) []string {
6213 poolSize := len(nc.srvPool)
6214 servers := make([]string, 0)
6215 for i := 0; i < poolSize; i++ {
6216 if implicitOnly && !nc.srvPool[i].isImplicit {
6217 continue
6218 }
6219 url := nc.srvPool[i].URL
6220 servers = append(servers, fmt.Sprintf("%s://%s", url.Scheme, url.Host))
6221 }
6222 return servers
6223}
6224
6225// Servers returns the list of known server urls, including additional
6226// servers discovered after a connection has been established. If

Callers 2

ServersMethod · 0.95
DiscoveredServersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected