3#include <xrpl/beast/utility/PropertyStream.h>
4#include <xrpl/peerfinder/detail/Tuning.h>
111 bool validationPublicKey,
148 case Result::InboundDisabled:
149 return "inbound disabled";
150 case Result::DuplicatePeer:
151 return "peer already connected";
152 case Result::IpLimitExceeded:
153 return "ip limit exceeded";
156 case Result::Success:
static constexpr auto kDefaultMaxPeers
The default value of Config::maxPeers.
Result
Possible results from activating a slot.
std::string_view to_string(Result result) noexcept
Converts a Result enum value to its string representation.
PeerFinder configuration settings.
std::size_t outPeers
The number of automatic outbound connections to maintain.
void onWrite(beast::PropertyStream::Map &map) const
Write the configuration into a property stream.
bool wantIncoming
true if we want to accept incoming connections.
bool peerPrivate
true if we want our IP address kept private.
std::uint16_t listeningPort
The listening port number.
friend bool operator==(Config const &lhs, Config const &rhs)=default
Compares two configurations for equality field by field.
bool autoConnect
true if we want to establish connections automatically
void applyTuning()
Adjusts the values so they follow the business rules.
static Config makeConfig(bool peerPrivate, bool standalone, PeerLimitConfig const &limits, std::uint16_t port, bool validationPublicKey, int ipLimit, bool verifyEndpoints)
Make peer_finder::Config from peer limit and server mode parameters.
std::size_t inPeers
The number of automatic inbound connections to maintain.
std::size_t maxPeers
The largest number of public peer slots to allow.
int ipLimit
Limit how many incoming connections we allow per IP.
std::size_t calcOutPeers() const
Returns a suitable value for outPeers according to the rules.
bool verifyEndpoints
true if we want to verify endpoints in TMEndpoints messages
std::string features
The set of features we advertise.
std::optional< std::size_t > outPeers
std::optional< std::size_t > maxPeers
std::optional< std::size_t > inPeers