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

Function ExpandCentralConfig

state/config.go:376–398  ·  view source on GitHub ↗
(cfg *CentralCfg)

Source from the content-addressed store, hash-verified

374}
375
376func ExpandCentralConfig(cfg *CentralCfg) {
377 // compatibility & convenience: advertise address as a host address (/32 or /128)
378 for idx, node := range cfg.Routers {
379 for _, addr := range node.Addresses {
380 advAddress := StaticPrefixHealth{
381 Prefix: AddrToPrefix(addr),
382 Metric: 0,
383 }
384 node.Prefixes = append([]PrefixHealthWrapper{{&advAddress}}, node.Prefixes...)
385 }
386 cfg.Routers[idx] = node
387 }
388 for idx, node := range cfg.Clients {
389 for _, addr := range node.Addresses {
390 advAddress := StaticPrefixHealth{
391 Prefix: AddrToPrefix(addr),
392 Metric: 0,
393 }
394 node.Prefixes = append([]PrefixHealthWrapper{{&advAddress}}, node.Prefixes...)
395 }
396 cfg.Clients[idx] = node
397 }
398}
399
400func (e *CentralCfg) IsRouter(node NodeId) bool {
401 idx := slices.IndexFunc(e.Routers, func(cfg RouterCfg) bool {

Callers 3

ApplyCentralConfigMethod · 0.92
BootstrapFunction · 0.92
verify.goFile · 0.92

Calls 1

AddrToPrefixFunction · 0.85

Tested by

no test coverage detected