20#include <xrpld/app/misc/HashRouter.h>
21#include <xrpld/app/misc/NetworkOPs.h>
22#include <xrpld/app/misc/ValidatorList.h>
23#include <xrpld/app/misc/ValidatorSite.h>
24#include <xrpld/app/rdb/RelationalDatabase.h>
25#include <xrpld/app/rdb/Wallet.h>
26#include <xrpld/overlay/Cluster.h>
27#include <xrpld/overlay/detail/ConnectAttempt.h>
28#include <xrpld/overlay/detail/PeerImp.h>
29#include <xrpld/overlay/detail/TrafficCount.h>
30#include <xrpld/overlay/detail/Tuning.h>
31#include <xrpld/overlay/predicates.h>
32#include <xrpld/peerfinder/make_Manager.h>
33#include <xrpld/rpc/handlers/GetCounts.h>
34#include <xrpld/rpc/json_body.h>
36#include <xrpl/basics/base64.h>
37#include <xrpl/basics/make_SSLContext.h>
38#include <xrpl/basics/random.h>
39#include <xrpl/beast/core/LexicalCast.h>
40#include <xrpl/protocol/STTx.h>
41#include <xrpl/server/SimpleWriter.h>
43#include <boost/algorithm/string/predicate.hpp>
44#include <boost/asio/executor_work_guard.hpp>
48namespace CrawlOptions {
66 overlay_.remove(*
this);
89 timer_.async_wait(boost::asio::bind_executor(
100 if (ec && ec != boost::asio::error::operation_aborted)
102 JLOG(overlay_.journal_.error()) <<
"on_timer: " << ec.message();
107 overlay_.m_peerFinder->once_per_second();
108 overlay_.sendEndpoints();
109 overlay_.autoConnect();
110 if (overlay_.app_.config().TX_REDUCE_RELAY_ENABLE)
111 overlay_.sendTxQueue();
114 overlay_.deleteIdlePeers();
127 boost::asio::io_context& io_context,
141 app_.journal(
"PeerFinder"),
147 ,
slots_(app.logs(), *this, app.config())
151 [counts =
m_traffic.getCounts(), collector]() {
154 for (
auto const& pair : counts)
180 handoff.
moved =
true;
182 JLOG(journal.
debug()) <<
"Peer connection upgrade from " << remote_endpoint;
185 auto const local_endpoint(
186 stream_ptr->next_layer().socket().local_endpoint(ec));
189 JLOG(journal.
debug()) << remote_endpoint <<
" failed: " << ec.message();
195 if (consumer.disconnect(journal))
205 handoff.
moved =
false;
214 return boost::iequals(s,
"peer");
217 handoff.
moved =
false;
226 if (!negotiatedVersion)
229 handoff.
moved =
false;
233 remote_endpoint.address(),
234 "Unable to agree on a protocol version");
243 handoff.
moved =
false;
247 remote_endpoint.address(),
248 "Incorrect security cookie");
260 remote_endpoint.address(),
266 bool const reserved =
271 if (result != PeerFinder::Result::success)
274 JLOG(journal.
debug()) <<
"Peer " << remote_endpoint
276 handoff.
moved =
false;
278 slot, request, remote_endpoint.address());
292 std::move(stream_ptr),
300 auto const result =
m_peers.emplace(peer->slot(), peer);
303 "ripple::OverlayImpl::onHandoff : peer is inserted");
306 list_.emplace(peer.get(), peer);
310 handoff.
moved =
true;
315 JLOG(journal.
debug()) <<
"Peer " << remote_endpoint
316 <<
" fails handshake (" << e.
what() <<
")";
319 handoff.
moved =
false;
321 slot, request, remote_endpoint.address(), e.
what());
335 return !versions.empty();
352 boost::beast::http::response<json_body> msg;
353 msg.version(request.version());
354 msg.result(boost::beast::http::status::service_unavailable);
358 ostr << remote_address;
359 msg.insert(
"Remote-Address", ostr.
str());
361 msg.insert(
"Content-Type",
"application/json");
362 msg.insert(boost::beast::http::field::connection,
"close");
367 ips.
append(_.address.to_string());
369 msg.prepare_payload();
380 boost::beast::http::response<boost::beast::http::empty_body> msg;
381 msg.version(request.version());
382 msg.result(boost::beast::http::status::bad_request);
383 msg.reason(
"Bad Request (" + text +
")");
385 msg.insert(
"Remote-Address", remote_address.to_string());
386 msg.insert(boost::beast::http::field::connection,
"close");
387 msg.prepare_payload();
396 XRPL_ASSERT(
work_,
"ripple::OverlayImpl::connect : work is set");
401 JLOG(
journal_.
info()) <<
"Over resource limit: " << remote_endpoint;
408 JLOG(
journal_.
debug()) <<
"Connect: No slot for " << remote_endpoint;
424 list_.emplace(p.get(), p);
437 auto const result =
m_peers.emplace(peer->slot(), peer);
440 "ripple::OverlayImpl::add_active : peer is inserted");
445 auto const result =
ids_.emplace(
451 "ripple::OverlayImpl::add_active : peer ID is inserted");
457 JLOG(
journal_.
debug()) <<
"activated " << peer->getRemoteAddress() <<
" ("
473 auto const iter =
m_peers.find(slot);
475 iter !=
m_peers.end(),
"ripple::OverlayImpl::remove : valid input");
498 if (bootstrapIps.empty())
501 bootstrapIps.
push_back(
"r.ripple.com 51235");
504 bootstrapIps.
push_back(
"sahyadri.isrdc.in 51235");
507 bootstrapIps.push_back(
"hubs.xrpkuwait.com 51235");
510 bootstrapIps.push_back(
"hub.xrpl-commons.org 51235");
520 for (
auto const& addr : addresses)
522 if (addr.port() == 0)
544 for (
auto& addr : addresses)
546 if (addr.port() == 0)
558 list_.emplace(timer.get(), timer);
585 for (
auto const& pair : stats)
588 item[
"category"] = pair.second.name;
590 item[
"messages_in"] =
std::to_string(pair.second.messagesIn.load());
592 item[
"messages_out"] =
std::to_string(pair.second.messagesOut.load());
608 auto const result(
ids_.emplace(
614 "ripple::OverlayImpl::activate : peer ID is inserted");
618 JLOG(
journal_.
debug()) <<
"activated " << peer->getRemoteAddress() <<
" ("
625 XRPL_ASSERT(
size(),
"ripple::OverlayImpl::activate : nonzero peers");
640 auto const n = m->list_size();
641 auto const& journal = from->pjournal();
643 protocol::TMManifests
relay;
647 auto& s = m->list().Get(i).stobject();
651 auto const serialized = mo->serialized;
658 relay.add_list()->set_stobject(s);
666 "ripple::OverlayImpl::onManifests : manifest "
667 "deserialization succeeded");
680 JLOG(journal.debug())
681 <<
"Malformed manifest #" << i + 1 <<
": " <<
strHex(s);
686 if (!
relay.list().empty())
729 sp->getNodePublic().data(), sp->getNodePublic().size());
730 pv[jss::type] = sp->slot()->inbound() ?
"in" :
"out";
732 duration_cast<seconds>(sp->uptime()).count());
735 pv[jss::ip] = sp->getRemoteAddress().address().to_string();
736 if (sp->slot()->inbound())
738 if (
auto port = sp->slot()->listening_port())
739 pv[jss::port] = *port;
748 auto version{sp->getVersion()};
749 if (!version.empty())
755 sp->ledgerRange(minSeq, maxSeq);
756 if (minSeq != 0 || maxSeq != 0)
757 pv[jss::complete_ledgers] =
767 bool const humanReadable =
false;
768 bool const admin =
false;
769 bool const counters =
false;
776 server_info.
removeMember(jss::load_factor_fee_escalation);
780 if (server_info.
isMember(jss::validated_ledger))
782 Json::Value& validated_ledger = server_info[jss::validated_ledger];
803 if (validators.
isMember(jss::publisher_lists))
805 Json::Value& publisher_lists = validators[jss::publisher_lists];
807 for (
auto& publisher : publisher_lists)
819 if (validatorSites.
isMember(jss::validator_sites))
821 validators[jss::validator_sites] =
822 std::move(validatorSites[jss::validator_sites]);
843 if (req.target() !=
"/crawl" ||
847 boost::beast::http::response<json_body> msg;
848 msg.version(req.version());
849 msg.result(boost::beast::http::status::ok);
851 msg.insert(
"Content-Type",
"application/json");
852 msg.insert(
"Connection",
"close");
872 msg.prepare_payload();
891 boost::beast::http::response<json_body> msg;
892 msg.version(req.version());
894 msg.insert(
"Content-Type",
"application/json");
895 msg.insert(
"Connection",
"close");
897 auto fail = [&msg, &handoff](
auto status) {
899 msg.insert(
"Content-Length",
"0");
903 msg.prepare_payload();
910 if (
auto slash = key.
find(
'/'); slash != std::string_view::npos)
912 auto verString = key.
substr(0, slash);
913 if (!boost::conversion::try_lexical_convert(verString, version))
914 return fail(boost::beast::http::status::bad_request);
915 key = key.
substr(slash + 1);
919 return fail(boost::beast::http::status::bad_request);
927 return fail(boost::beast::http::status::not_found);
931 return fail(boost::beast::http::status::bad_request);
935 msg.result(boost::beast::http::status::ok);
939 msg.prepare_payload();
948 if (req.target() !=
"/health")
950 boost::beast::http::response<json_body> msg;
951 msg.version(req.version());
953 msg.insert(
"Content-Type",
"application/json");
954 msg.insert(
"Connection",
"close");
958 int last_validated_ledger_age = -1;
959 if (info.isMember(jss::validated_ledger))
960 last_validated_ledger_age =
961 info[jss::validated_ledger][jss::age].asInt();
962 bool amendment_blocked =
false;
963 if (info.isMember(jss::amendment_blocked))
964 amendment_blocked =
true;
965 int number_peers = info[jss::peers].asInt();
966 std::string server_state = info[jss::server_state].asString();
967 auto load_factor = info[jss::load_factor_server].asDouble() /
968 info[jss::load_base].asDouble();
970 enum { healthy, warning, critical };
971 int health = healthy;
972 auto set_health = [&health](
int state) {
978 if (last_validated_ledger_age >= 7 || last_validated_ledger_age < 0)
980 msg.body()[jss::info][jss::validated_ledger] =
981 last_validated_ledger_age;
982 if (last_validated_ledger_age < 20)
985 set_health(critical);
988 if (amendment_blocked)
990 msg.body()[jss::info][jss::amendment_blocked] =
true;
991 set_health(critical);
994 if (number_peers <= 7)
996 msg.body()[jss::info][jss::peers] = number_peers;
997 if (number_peers != 0)
1000 set_health(critical);
1003 if (!(server_state ==
"full" || server_state ==
"validating" ||
1004 server_state ==
"proposing"))
1006 msg.body()[jss::info][jss::server_state] = server_state;
1007 if (server_state ==
"syncing" || server_state ==
"tracking" ||
1008 server_state ==
"connected")
1010 set_health(warning);
1013 set_health(critical);
1016 if (load_factor > 100)
1018 msg.body()[jss::info][jss::load_factor] = load_factor;
1019 if (load_factor < 1000)
1020 set_health(warning);
1022 set_health(critical);
1028 msg.result(boost::beast::http::status::ok);
1031 msg.result(boost::beast::http::status::service_unavailable);
1034 msg.result(boost::beast::http::status::internal_server_error);
1038 msg.prepare_payload();
1074 active =
ids_.size();
1075 disabled = enabledInSkip = 0;
1080 for (
auto& [
id, w] :
ids_)
1082 if (p = w.lock(); p !=
nullptr)
1084 bool const reduceRelayEnabled = p->txReduceRelayEnabled();
1086 if (!reduceRelayEnabled)
1089 if (toSkip.
count(
id) == 0)
1091 else if (reduceRelayEnabled)
1110 auto const iter =
ids_.find(
id);
1111 if (iter !=
ids_.end())
1112 return iter->second.lock();
1124 for (
auto const& e :
ids_)
1126 if (peer = e.second.lock(); peer !=
nullptr)
1128 if (peer->getNodePublic() == pubKey)
1144 protocol::TMProposeSet& m,
1153 if (toSkip->find(p->id()) == toSkip->end())
1170 protocol::TMValidation& m,
1179 if (toSkip->find(p->id()) == toSkip->end())
1195 protocol::TMManifests
tm;
1200 tm.add_list()->set_stobject(
1202 hr.addSuppression(
manifest.hash());
1207 if (
tm.list_size() != 0)
1223 bool relay = tx.has_value();
1226 auto& txn = tx->
get();
1243 <<
"not relaying tx, total peers " << peers.
size();
1244 for (
auto const& p : peers)
1245 p->addTxQueue(
hash);
1249 auto& txn = tx->get();
1256 for (
auto const& p : peers)
1272 if (enabledTarget > enabledInSkip)
1276 <<
" selected " << enabledTarget <<
" skip "
1277 << toSkip.
size() <<
" disabled " << disabled;
1281 for (
auto const& p : peers)
1284 if (!p->txReduceRelayEnabled())
1288 else if (enabledAndRelayed < enabledTarget)
1290 enabledAndRelayed++;
1295 p->addTxQueue(
hash);
1306 list_.erase(&child);
1330 for (
auto const& element :
list_)
1336 for (
auto const& child : children)
1338 if (child !=
nullptr)
1347 for (
auto addr : result)
1354 auto const result =
m_peerFinder->buildEndpointsForPeers();
1355 for (
auto const& e : result)
1360 auto const iter =
m_peers.find(e.first);
1362 peer = iter->second.lock();
1365 peer->sendEndpoints(e.second.begin(), e.second.end());
1373 if (p->txReduceRelayEnabled())
1384 protocol::TMSquelch m;
1386 m.set_validatorpubkey(validator.data(), validator.size());
1388 m.set_squelchduration(squelchDuration);
1420 protocol::MessageType type)
1422 if (!
slots_.baseSquelchReady())
1425 if (!
strand_.running_in_this_thread())
1431 validator = validator,
1432 peers = std::move(peers),
1437 for (
auto id : peers)
1438 slots_.updateSlotAndSquelch(key, validator,
id, type, [&]() {
1448 protocol::MessageType type)
1450 if (!
slots_.baseSquelchReady())
1453 if (!
strand_.running_in_this_thread())
1457 [
this, key = key, validator = validator, peer, type]() {
1461 slots_.updateSlotAndSquelch(key, validator, peer, type, [&]() {
1469 if (!
strand_.running_in_this_thread())
1472 slots_.deletePeer(
id,
true);
1478 if (!
strand_.running_in_this_thread())
1481 slots_.deleteIdlePeers();
1492 auto const& section = config.
section(
"overlay");
1497 Throw<std::runtime_error>(
"Configured IP limit is invalid");
1500 set(ip,
"public_ip", section);
1503 boost::system::error_code ec;
1504 setup.
public_ip = boost::asio::ip::make_address(ip, ec);
1506 Throw<std::runtime_error>(
"Configured public IP is invalid");
1511 auto const& section = config.
section(
"crawl");
1512 auto const& values = section.
values();
1514 if (values.size() > 1)
1516 Throw<std::runtime_error>(
1517 "Configured [crawl] section is invalid, too many values");
1520 bool crawlEnabled =
true;
1523 if (values.size() == 1)
1527 crawlEnabled = boost::lexical_cast<bool>(values.front());
1529 catch (boost::bad_lexical_cast
const&)
1531 Throw<std::runtime_error>(
1532 "Configured [crawl] section has invalid value: " +
1539 if (get<bool>(section,
"overlay",
true))
1543 if (get<bool>(section,
"server",
true))
1547 if (get<bool>(section,
"counts",
false))
1551 if (get<bool>(section,
"unl",
true))
1558 auto const& section = config.
section(
"vl");
1565 auto id = config.
legacy(
"network_id");
1572 if (
id ==
"testnet")
1578 setup.
networkID = beast::lexicalCastThrow<std::uint32_t>(
id);
1583 Throw<std::runtime_error>(
1584 "Configured [network_id] section is invalid: must be a number "
1585 "or one of the strings 'main', 'testnet' or 'devnet'.");
1598 boost::asio::io_context& io_context,
Value & append(Value const &value)
Append value to array at the end.
Value removeMember(char const *key)
Remove and return the named member.
bool isMember(char const *key) const
Return true if the object has a member named key.
A version-independent IP address and port combination.
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
std::string const & name() const
Returns the name of this source.
void add(Source &source)
Add a child source.
Wraps a Journal::Sink to prefix its output with a string.
virtual Config & config()=0
virtual beast::Journal journal(std::string const &name)=0
virtual ValidatorSite & validatorSites()=0
virtual DatabaseCon & getWalletDB()=0
Retrieve the "wallet database".
virtual NetworkOPs & getOPs()=0
virtual ValidatorList & validators()=0
virtual std::optional< PublicKey const > getValidationPublicKey() const =0
virtual ManifestCache & validatorManifests()=0
virtual PeerReservationTable & peerReservations()=0
virtual Cluster & cluster()=0
virtual HashRouter & getHashRouter()=0
Holds unparsed configuration information.
Section & section(std::string const &name)
Returns the section with the given name.
void legacy(std::string const §ion, std::string value)
Set a value that is not a key/value pair.
std::optional< std::string > member(PublicKey const &node) const
Determines whether a node belongs in the cluster.
std::vector< std::string > IPS_FIXED
std::vector< std::string > IPS
std::size_t TX_REDUCE_RELAY_MIN_PEERS
bool TX_REDUCE_RELAY_ENABLE
bool TX_REDUCE_RELAY_METRICS
std::size_t TX_RELAY_PERCENTAGE
LockedSociSession checkoutDb()
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
virtual void pubManifest(Manifest const &)=0
std::uint32_t sequence() const
A monotonically increasing number used to detect new manifests.
void for_each_manifest(Function &&f) const
Invokes the callback once for every populated manifest.
ManifestDisposition applyManifest(Manifest m)
Add manifest to cache.
virtual Json::Value getServerInfo(bool human, bool admin, bool counters)=0
Child(OverlayImpl &overlay)
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
boost::system::error_code error_code
Json::Value getUnlInfo()
Returns information about the local server's UNL.
static std::string makePrefix(std::uint32_t id)
PeerFinder::Manager & peerFinder()
boost::asio::ip::tcp::endpoint endpoint_type
bool processHealth(http_request_type const &req, Handoff &handoff)
Handles health requests.
boost::asio::ip::address address_type
boost::asio::io_context & io_context_
static bool is_upgrade(boost::beast::http::header< true, Fields > const &req)
std::condition_variable_any cond_
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
void deleteIdlePeers()
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
PeerSequence getActivePeers() const override
Returns a sequence representing the current list of peers.
hash_map< std::shared_ptr< PeerFinder::Slot >, std::weak_ptr< PeerImp > > m_peers
void add_active(std::shared_ptr< PeerImp > const &peer)
std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey) override
Returns the peer with the matching public key, or null.
Resource::Manager & m_resourceManager
std::shared_ptr< Message > manifestMessage_
std::optional< std::uint32_t > manifestListSeq_
void squelch(PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
Squelch handler.
std::shared_ptr< Writer > makeErrorResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address, std::string msg)
reduce_relay::Slots< UptimeClock > slots_
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const override
Returns the peer with the matching short id, or null.
std::atomic< Peer::id_t > next_id_
std::weak_ptr< Timer > timer_
metrics::TxMetrics txMetrics_
void broadcast(protocol::TMProposeSet &m) override
Broadcast a proposal.
void onPeerDeactivate(Peer::id_t id)
bool processRequest(http_request_type const &req, Handoff &handoff)
Handles non-peer protocol requests.
std::recursive_mutex mutex_
void remove(std::shared_ptr< PeerFinder::Slot > const &slot)
OverlayImpl(Application &app, Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_context &io_context, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
void sendTxQueue()
Send once a second transactions' hashes aggregated by peers.
void reportOutboundTraffic(TrafficCount::category cat, int bytes)
std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
Relay a proposal.
std::size_t size() const override
The number of active peers on the network Active peers are only those peers that have completed the h...
boost::asio::strand< boost::asio::io_context::executor_type > strand_
void unsquelch(PublicKey const &validator, Peer::id_t id) const override
Unsquelch handler.
std::shared_ptr< Writer > makeRedirectResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address)
void for_each(UnaryFunc &&f) const
Json::Value getOverlayInfo()
Returns information about peers on the overlay network.
Resource::Manager & resourceManager()
static bool isPeerUpgrade(http_request_type const &request)
Json::Value getServerCounts()
Returns information about the local server's performance counters.
void reportInboundTraffic(TrafficCount::category cat, int bytes)
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
std::unique_ptr< PeerFinder::Manager > m_peerFinder
void connect(beast::IP::Endpoint const &remote_endpoint) override
Establish a peer connection to the specified endpoint.
Handoff onHandoff(std::unique_ptr< stream_type > &&bundle, http_request_type &&request, endpoint_type remote_endpoint) override
Conditionally accept an incoming HTTP request.
Setup const & setup() const
std::shared_ptr< Message > getManifestsMessage()
hash_map< Peer::id_t, std::weak_ptr< PeerImp > > ids_
Json::Value getServerInfo()
Returns information about the local server.
bool processValidatorList(http_request_type const &req, Handoff &handoff)
Handles validator list requests.
Json::Value json() override
Return diagnostics on the status of all peers.
void checkTracking(std::uint32_t) override
Calls the checkTracking function on each peer.
ServerHandler & serverHandler_
bool processCrawl(http_request_type const &req, Handoff &handoff)
Handles crawl requests.
int limit() override
Returns the maximum number of peers we are configured to allow.
void updateSlotAndSquelch(uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
Updates message count for validator/peer.
beast::Journal const journal_
boost::container::flat_map< Child *, std::weak_ptr< Child > > list_
Manages the set of connected peers.
virtual std::shared_ptr< Slot > new_outbound_slot(beast::IP::Endpoint const &remote_endpoint)=0
Create a new outbound slot with the specified remote endpoint.
bool contains(PublicKey const &nodeId)
void resolve(std::vector< std::string > const &names, Handler handler)
resolve all hostnames on the list
Tracks load and resource consumption.
virtual Consumer newInboundEndpoint(beast::IP::Endpoint const &address)=0
Create a new endpoint keyed by inbound IP address or the forwarded IP if proxied.
virtual Consumer newOutboundEndpoint(beast::IP::Endpoint const &address)=0
Create a new endpoint keyed by outbound IP address and port.
std::vector< std::string > const & values() const
Returns all the values in the section.
void setup(Setup const &setup, beast::Journal journal)
auto const & getCounts() const
An up-to-date copy of all the counters.
void addCount(category cat, bool inbound, int bytes)
Account for traffic associated with the given category.
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
std::optional< Json::Value > getAvailable(std::string_view pubKey, std::optional< std::uint32_t > forceVersion={})
Returns the current valid list for the given publisher key, if available, as a Json object.
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
Json::Value getJson() const
Return JSON representation of configured validator sites.
T emplace_back(T... args)
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
bool is_private(Address const &addr)
Returns true if the address is a private unroutable address.
Result split_commas(FwdIt first, FwdIt last)
bool is_keep_alive(boost::beast::http::message< isRequest, Body, Fields > const &m)
std::string const & getFullVersionString()
Full server version string.
@ checkIdlePeers
How often we check for idle peers (seconds)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
std::optional< ProtocolVersion > negotiateProtocolVersion(std::vector< ProtocolVersion > const &versions)
Given a list of supported protocol versions, choose the one we prefer.
std::optional< Manifest > deserializeManifest(Slice s, beast::Journal journal)
Constructs Manifest from serialized string.
std::vector< ProtocolVersion > parseProtocolVersions(boost::beast::string_view const &value)
Parse a set of protocol versions.
bool isPseudoTx(STObject const &tx)
Check whether a transaction is a pseudo-transaction.
void addValidatorManifest(soci::session &session, std::string const &serialized)
addValidatorManifest Saves the manifest of a validator to the database.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
std::optional< uint256 > makeSharedValue(stream_type &ssl, beast::Journal journal)
Computes a shared value based on the SSL connection state.
std::shared_ptr< boost::asio::ssl::context > make_SSLContext(std::string const &cipherList)
Create a self-signed SSL context that allows anonymous Diffie Hellman.
std::shared_ptr< Message > makeSquelchMessage(PublicKey const &validator, bool squelch, uint32_t squelchDuration)
std::string strHex(FwdIt begin, FwdIt end)
@ accepted
Manifest is valid.
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Stopwatch & stopwatch()
Returns an instance of a wall clock.
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Json::Value getCountsJson(Application &app, int minObjectCount)
std::string to_string(base_uint< Bits, Tag > const &a)
PublicKey verifyHandshake(boost::beast::http::fields const &headers, ripple::uint256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::IP::Address public_ip, beast::IP::Address remote, Application &app)
Validate header fields necessary for upgrading the link to the peer protocol.
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_context &io_context, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Overlay::Setup setup_Overlay(BasicConfig const &config)
constexpr Number squelch(Number const &x, Number const &limit) noexcept
beast::xor_shift_engine & default_prng()
Return the default random engine.
static boost::asio::ip::tcp::endpoint to_asio_endpoint(IP::Endpoint const &address)
static IP::Endpoint from_asio(boost::asio::ip::address const &address)
Used to indicate the result of a server connection handoff.
std::shared_ptr< Writer > response
void on_timer(error_code ec)
Timer(OverlayImpl &overlay)
beast::IP::Address public_ip
std::uint32_t crawlOptions
std::shared_ptr< boost::asio::ssl::context > context
std::optional< std::uint32_t > networkID
PeerFinder configuration settings.
static Config makeConfig(ripple::Config const &config, std::uint16_t port, bool validationPublicKey, int ipLimit)
Make PeerFinder::Config from configuration parameters.
void addMetrics(protocol::MessageType type, std::uint32_t val)
Add protocol message metrics.