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

Method setStatus

tailnet/node.go:172–195  ·  view source on GitHub ↗

setStatus handles the status callback from the wireguard engine to learn about new endpoints (e.g. discovered by STUN). u.L MUST NOT be held

(s *wgengine.Status, err error)

Source from the content-addressed store, hash-verified

170// setStatus handles the status callback from the wireguard engine to learn about new endpoints
171// (e.g. discovered by STUN). u.L MUST NOT be held
172func (u *nodeUpdater) setStatus(s *wgengine.Status, err error) {
173 u.logger.Debug(context.Background(), "wireguard status", slog.F("status", s), slog.Error(err))
174 if err != nil {
175 return
176 }
177 u.L.Lock()
178 defer u.L.Unlock()
179 if s.AsOf.Before(u.lastStatus) {
180 // Don't process outdated status!
181 return
182 }
183 u.lastStatus = s.AsOf
184 endpoints := make([]string, len(s.LocalAddrs))
185 for i, ep := range s.LocalAddrs {
186 endpoints[i] = ep.Addr.String()
187 }
188 if slices.Equal(endpoints, u.endpoints) {
189 // No need to update the node if nothing changed!
190 return
191 }
192 u.endpoints = endpoints
193 u.dirty = true
194 u.Broadcast()
195}
196
197// setAddresses sets the local addresses for the node. u.L MUST NOT be held.
198func (u *nodeUpdater) setAddresses(ips []netip.Prefix) {

Calls 5

ErrorMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45
StringMethod · 0.45
EqualMethod · 0.45