void OverlayImpl::onPrepare () { m_peerFinder->setConfig(); auto bootstrapIps (getConfig ().IPS); if (!bootstrapIps.empty ()) { m_resolver.resolve (bootstrapIps, [this]( std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { std::vector <std::string> ips; for (auto const& addr : addresses) ips.push_back (to_string (addr)); std::string const base ("config: "); if (!ips.empty ()) m_peerFinder->addFallbackStrings (base + name, ips); }); } // Add the ips_fixed from the stellard.cfg file if (! getConfig ().RUN_STANDALONE && !getConfig ().IPS_FIXED.empty ()) { m_resolver.resolve (getConfig ().IPS_FIXED, [this]( std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { if (!addresses.empty ()) m_peerFinder->addFixedPeer (name, addresses); }); } // Configure the peer doors, which allow the server to accept incoming // peer connections: if (! getConfig ().RUN_STANDALONE) { m_doorDirect = make_PeerDoor ( PeerDoor::sslRequired, *this, getConfig ().PEER_IP, getConfig ().peerListeningPort, m_io_service); if (getConfig ().peerPROXYListeningPort != 0) { m_doorProxy = make_PeerDoor ( PeerDoor::sslAndPROXYRequired, *this, getConfig ().PEER_IP, getConfig ().peerPROXYListeningPort, m_io_service); } } }
void OverlayImpl::onPrepare () { PeerFinder::Config config; if (getConfig ().PEERS_MAX != 0) config.maxPeers = getConfig ().PEERS_MAX; config.outPeers = config.calcOutPeers(); config.wantIncoming = (! getConfig ().PEER_PRIVATE) && (getConfig().peerListeningPort != 0); // if it's a private peer or we are running as standalone // automatic connections would defeat the purpose. config.autoConnect = !getConfig().RUN_STANDALONE && !getConfig().PEER_PRIVATE; config.listeningPort = getConfig().peerListeningPort; config.features = ""; // Enforce business rules config.applyTuning (); m_peerFinder->setConfig (config); auto bootstrapIps (getConfig ().IPS); // If no IPs are specified, use the Ripple Labs round robin // pool to get some servers to insert into the boot cache. if (bootstrapIps.empty ()) bootstrapIps.push_back ("r.ripple.com 51235"); if (!bootstrapIps.empty ()) { m_resolver.resolve (bootstrapIps, [this]( std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { std::vector <std::string> ips; for (auto const& addr : addresses) ips.push_back (to_string (addr)); std::string const base ("config: "); if (!ips.empty ()) m_peerFinder->addFallbackStrings (base + name, ips); }); } // Add the ips_fixed from the rippled.cfg file if (! getConfig ().RUN_STANDALONE && !getConfig ().IPS_FIXED.empty ()) { m_resolver.resolve (getConfig ().IPS_FIXED, [this]( std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { if (!addresses.empty ()) m_peerFinder->addFixedPeer (name, addresses); }); } // Configure the peer doors, which allow the server to accept incoming // peer connections: if (! getConfig ().RUN_STANDALONE) { m_doorDirect = make_PeerDoor ( PeerDoor::sslRequired, *this, getConfig ().PEER_IP, getConfig ().peerListeningPort, m_io_service); if (getConfig ().peerPROXYListeningPort != 0) { m_doorProxy = make_PeerDoor ( PeerDoor::sslAndPROXYRequired, *this, getConfig ().PEER_IP, getConfig ().peerPROXYListeningPort, m_io_service); } } }