Reusable peer lookup/dial logic

This commit is contained in:
Neil Alexander 2024-11-16 22:59:03 +00:00
parent 75d2080e53
commit 42873be09b
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
12 changed files with 193 additions and 124 deletions

View file

@ -53,7 +53,15 @@ func (m *Yggdrasil) StartJSON(configjson []byte) error {
}
// Set up the Yggdrasil node itself.
{
options := []core.SetupOption{}
iprange := net.IPNet{
IP: net.ParseIP("200::"),
Mask: net.CIDRMask(7, 128),
}
options := []core.SetupOption{
core.PeerFilter(func(ip net.IP) bool {
return !iprange.Contains(ip)
}),
}
for _, peer := range m.config.Peers {
options = append(options, core.Peer{URI: peer})
}