MCPcopy Create free account
hub / github.com/encodeous/nylon / advertisementsForNode

Function advertisementsForNode

core/ipc_handler.go:289–305  ·  view source on GitHub ↗
(n *Nylon, id state.NodeId)

Source from the content-addressed store, hash-verified

287}
288
289func advertisementsForNode(n *Nylon, id state.NodeId) []*protocol.Advertisement {
290 ads := make([]*protocol.Advertisement, 0)
291 for prefix, adv := range n.RouterState.Advertised {
292 if adv.NodeId != id {
293 continue
294 }
295 ads = append(ads, &protocol.Advertisement{
296 NodeId: string(adv.NodeId),
297 Prefix: prefix.String(),
298 Metric: adv.MetricFn(),
299 ExpiryUnix: adv.Expiry.Unix(),
300 PassiveHold: adv.IsPassiveHold,
301 })
302 }
303 sortAdvertisements(ads)
304 return ads
305}
306
307func wireGuardPeerStats(n *Nylon) map[state.NyPublicKey]device.PeerStatus {
308 stats := make(map[state.NyPublicKey]device.PeerStatus)

Callers 1

buildNeighboursFunction · 0.85

Calls 2

sortAdvertisementsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected