// Configure the pex.PeerList and load local data func (self *Peers) Init() { peers := pex.NewPex(self.Config.Max) err := peers.Load(self.Config.DataDirectory) if err != nil { logger.Notice("Failed to load peer database") logger.Notice("Reason: %v", err) } logger.Debug("Init peers") peers.AllowLocalhost = self.Config.AllowLocalhost //Boot strap peers for _, addr := range BootStrapPeers { peers.AddPeer(addr) } self.Peers = peers }
// Init configures the pex.PeerList and load local data func (self *Peers) Init() { peers := pex.NewPex(self.Config.Max) err := peers.Load(self.Config.DataDirectory) if err != nil { if !os.IsNotExist(err) { logger.Notice("Failed to load peer database") logger.Notice("Reason: %v", err) } } logger.Debug("Init peers") peers.AllowLocalhost = self.Config.AllowLocalhost //Boot strap peers for _, addr := range DefaultConnections { peers.AddPeer(addr) } self.Peers = peers self.Peers.Save(self.Config.DataDirectory) }