mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Reusable peer lookup/dial logic
This commit is contained in:
		
							parent
							
								
									75d2080e53
								
							
						
					
					
						commit
						42873be09b
					
				
					 12 changed files with 193 additions and 124 deletions
				
			
		| 
						 | 
				
			
			@ -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})
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue