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

@ -191,9 +191,16 @@ func main() {
// Set up the Yggdrasil node itself.
{
iprange := net.IPNet{
IP: net.ParseIP("200::"),
Mask: net.CIDRMask(7, 128),
}
options := []core.SetupOption{
core.NodeInfo(cfg.NodeInfo),
core.NodeInfoPrivacy(cfg.NodeInfoPrivacy),
core.PeerFilter(func(ip net.IP) bool {
return !iprange.Contains(ip)
}),
}
for _, addr := range cfg.Listen {
options = append(options, core.ListenAddress(addr))