MCPcopy Index your code
hub / github.com/coder/coder / peerConfigLocked

Method peerConfigLocked

tailnet/configmaps.go:242–258  ·  view source on GitHub ↗

peerConfigLocked returns the set of peer nodes we have. c.L must be held.

()

Source from the content-addressed store, hash-verified

240
241// peerConfigLocked returns the set of peer nodes we have. c.L must be held.
242func (c *configMaps) peerConfigLocked() []*tailcfg.Node {
243 out := make([]*tailcfg.Node, 0, len(c.peers))
244 for _, p := range c.peers {
245 // Don't add nodes that we havent received a READY_FOR_HANDSHAKE for
246 // yet, if they're a destination. If we received a READY_FOR_HANDSHAKE
247 // for a peer before we receive their node, the node will be nil.
248 if (!p.readyForHandshake && p.isDestination) || p.node == nil {
249 continue
250 }
251 n := p.node.Clone()
252 if c.blockEndpoints {
253 n.Endpoints = nil
254 }
255 out = append(out, n)
256 }
257 return out
258}
259
260func (c *configMaps) setTunnelDestination(id uuid.UUID) {
261 c.L.Lock()

Callers 1

netMapLockedMethod · 0.95

Calls 1

CloneMethod · 0.45

Tested by

no test coverage detected