1#include <xrpl/basics/chrono.h>
2#include <xrpl/beast/core/CurrentThreadName.h>
3#include <xrpl/beast/insight/Collector.h>
4#include <xrpl/beast/net/IPAddressConversion.h>
5#include <xrpl/beast/net/IPEndpoint.h>
6#include <xrpl/beast/utility/Journal.h>
7#include <xrpl/beast/utility/PropertyStream.h>
8#include <xrpl/json/json_value.h>
9#include <xrpl/resource/Consumer.h>
10#include <xrpl/resource/Gossip.h>
11#include <xrpl/resource/ResourceManager.h>
12#include <xrpl/resource/detail/Logic.h>
14#include <boost/asio/ip/address.hpp>
15#include <boost/system/detail/error_code.hpp>
77 boost::system::error_code ec;
78 auto const proxiedIp = boost::asio::ip::make_address(
forwardedFor, ec);
84 <<
" doesn't convert to IP endpoint: " << ec.message();
A version-independent IP address and port combination.
std::string to_string() const
Returns a string representing the endpoint.
A generic endpoint for log messages.
An endpoint that consumes resources.
Consumer newInboundEndpoint(beast::IP::Endpoint const &address)
void importConsumers(std::string const &origin, Gossip const &gossip)
Consumer newUnlimitedEndpoint(beast::IP::Endpoint const &address)
Create endpoint that should not have resource limits applied.
void onWrite(beast::PropertyStream::Map &map)
Consumer newOutboundEndpoint(beast::IP::Endpoint const &address)
std::condition_variable cond_
Json::Value getJson() override
Extract consumer information for reporting.
Consumer newOutboundEndpoint(beast::IP::Endpoint const &address) override
Create a new endpoint keyed by outbound IP address and port.
Consumer newUnlimitedEndpoint(beast::IP::Endpoint const &address) override
Create a new unlimited endpoint keyed by forwarded IP.
Gossip exportConsumers() override
Extract packaged consumer information for export.
ManagerImp(ManagerImp const &)=delete
void onWrite(beast::PropertyStream::Map &map) override
Subclass override.
Json::Value getJson(int threshold) override
Consumer newInboundEndpoint(beast::IP::Endpoint const &address, bool const proxy, std::string_view forwardedFor) override
Consumer newInboundEndpoint(beast::IP::Endpoint const &address) override
Create a new endpoint keyed by inbound IP address or the forwarded IP if proxied.
beast::Journal const journal_
ManagerImp & operator=(ManagerImp const &)=delete
void importConsumers(std::string const &origin, Gossip const &gossip) override
Import packaged consumer information.
ManagerImp(beast::insight::Collector::ptr const &collector, beast::Journal journal)
Tracks load and resource consumption.
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string_view forwardedFor(http_request_type const &request)
Stopwatch & stopwatch()
Returns an instance of a wall clock.
static IP::Endpoint from_asio(boost::asio::ip::address const &address)
Data format for exchanging consumption information across peers.