88#include "librats/util/rats_export.h"
93#include "librats/transport/relay_link.h"
97#include <condition_variable>
182 uint32_t
window = Circuit::kDefaultWindow;
190 std::chrono::milliseconds
tick{250};
225 std::shared_ptr<State> state_;
231 std::atomic<bool> running_{
false};
232 std::mutex worker_mutex_;
233 std::condition_variable worker_cv_;
size_t carried_circuits() const
Circuits this node is carrying on behalf of other peers.
size_t attempts() const
Attempts to reach a peer through a relay that are currently running.
bool connect_via_relay(const PeerId &target) override
Try to reach target through a node both ends are connected to.
size_t forwarded_circuits() const
Of those, the ones whose datagrams it forwards rather than carrying a stream.
uint64_t carried_bytes() const
Bytes forwarded on behalf of other peers.
size_t circuits() const
Circuits this node terminates (relayed peers, live or still being set up).
bool serves(const PeerId &peer) const override
Whether peer said it carries circuits for others — a node to try first for anything relayed,...
void attach(NodeContext &ctx) override
A pluggable network subsystem.
Self-certifying peer identity.
The narrow contract a subsystem needs from the node — and nothing more.
Capability that lets a sibling module ask for a peer to be reached through a third node,...
Interface-keyed service lookup for targeted, synchronous module calls.
std::chrono::milliseconds request_window
std::chrono::milliseconds tick
Bookkeeping cadence — attempt timeouts, cooldowns, circuit expiry.
uint64_t max_circuit_rate_bps
Bits per second one circuit may move each way, on average over circuit_burst: bursts up to that much ...
std::chrono::milliseconds open_timeout
How long an attempt may take from the first probe to a live connection.
std::chrono::milliseconds circuit_burst
What the rate is averaged over.
uint32_t window
Bytes this node is willing to have in flight per byte-stream circuit — the credit window it advertise...
std::chrono::milliseconds cooldown
How long after a failed attempt before the same target may be tried again.
bool enable_client
Open circuits through other peers. Off makes this a relay-only node.
size_t max_outbound_circuits
Circuits this node may hold open as a client at once.
bool upgrade_with_hole_punch
When a relayed peer connects, ask HolePunch to try it directly, so the circuit is replaced by a direc...
bool accept_inbound
Accept circuits other peers open toward us.
bool serve
Serve as a relay.
size_t max_probes
Peers asked whether they hold a target, per attempt.
size_t max_circuits_per_peer
Circuits one peer may have us carrying, so a single peer cannot take the whole budget.
size_t max_circuits
Circuits this node will carry for others at once.
size_t request_budget
Requests (probes and circuit openings) one peer may make per window.
std::chrono::seconds max_circuit_duration
How long one circuit may live.
size_t max_inbound_circuits
Circuits opened TO us that may be live at once.