Back to Site
Loading...
Searching...
No Matches
librats::Relay::Config Struct Reference

#include <relay.h>

Public Attributes

bool enable_client = true
 Open circuits through other peers. Off makes this a relay-only node.
size_t max_probes = 3
 Peers asked whether they hold a target, per attempt.
size_t max_outbound_circuits = 8
 Circuits this node may hold open as a client at once.
std::chrono::milliseconds open_timeout {8000}
 How long an attempt may take from the first probe to a live connection.
std::chrono::milliseconds cooldown {60000}
 How long after a failed attempt before the same target may be tried again.
bool accept_inbound = true
 Accept circuits other peers open toward us.
size_t max_inbound_circuits = 16
 Circuits opened TO us that may be live at once.
bool serve = false
 Serve as a relay.
size_t max_circuits = 32
 Circuits this node will carry for others at once.
size_t max_circuits_per_peer = 2
 Circuits one peer may have us carrying, so a single peer cannot take the whole budget.
uint64_t max_circuit_rate_bps = 10'000'000
 Bits per second one circuit may move each way, on average over circuit_burst: bursts up to that much pass as they come.
std::chrono::milliseconds circuit_burst {2000}
 What the rate is averaged over.
std::chrono::seconds max_circuit_duration {3600}
 How long one circuit may live.
size_t request_budget = 8
 Requests (probes and circuit openings) one peer may make per window.
std::chrono::milliseconds request_window {1000}
uint32_t window = Circuit::kDefaultWindow
 Bytes this node is willing to have in flight per byte-stream circuit — the credit window it advertises (see transport/relay_link.h).
bool upgrade_with_hole_punch = true
 When a relayed peer connects, ask HolePunch to try it directly, so the circuit is replaced by a direct link as soon as one is possible.
std::chrono::milliseconds tick {250}
 Bookkeeping cadence — attempt timeouts, cooldowns, circuit expiry.

Detailed Description

Definition at line 107 of file relay.h.

Member Data Documentation

◆ accept_inbound

bool librats::Relay::Config::accept_inbound = true

Accept circuits other peers open toward us.

Off makes this node unreachable by relay, which is a choice a well-connected node can make.

Definition at line 135 of file relay.h.

◆ circuit_burst

std::chrono::milliseconds librats::Relay::Config::circuit_burst {2000}

What the rate is averaged over.

Definition at line 165 of file relay.h.

◆ cooldown

std::chrono::milliseconds librats::Relay::Config::cooldown {60000}

How long after a failed attempt before the same target may be tried again.

Only an attempt WE started ever ends in one.

Definition at line 129 of file relay.h.

◆ enable_client

bool librats::Relay::Config::enable_client = true

Open circuits through other peers. Off makes this a relay-only node.

Definition at line 111 of file relay.h.

◆ max_circuit_duration

std::chrono::seconds librats::Relay::Config::max_circuit_duration {3600}

How long one circuit may live.

0 removes the cap. A circuit is a fallback that a punch is still trying to replace, so this is a bound on a forgotten one, not on a call.

Definition at line 170 of file relay.h.

◆ max_circuit_rate_bps

uint64_t librats::Relay::Config::max_circuit_rate_bps = 10'000'000

Bits per second one circuit may move each way, on average over circuit_burst: bursts up to that much pass as they come.

0 removes the cap. Past it a circuit is slowed, never closed — what a call or a transfer through a relay can rely on is the rate, not a volume it runs out of. A forwarded circuit is held the way a bottleneck link holds a flow (a short queue, see transport/udp_mux.h); a byte stream by withholding the far end's credit until the sender is back within it. The default carries a 1080p call with room to spare.

Definition at line 162 of file relay.h.

◆ max_circuits

size_t librats::Relay::Config::max_circuits = 32

Circuits this node will carry for others at once.

Definition at line 148 of file relay.h.

◆ max_circuits_per_peer

size_t librats::Relay::Config::max_circuits_per_peer = 2

Circuits one peer may have us carrying, so a single peer cannot take the whole budget.

Definition at line 152 of file relay.h.

◆ max_inbound_circuits

size_t librats::Relay::Config::max_inbound_circuits = 16

Circuits opened TO us that may be live at once.

Definition at line 138 of file relay.h.

◆ max_outbound_circuits

size_t librats::Relay::Config::max_outbound_circuits = 8

Circuits this node may hold open as a client at once.

Bounds both memory and how many relayed peers a discovery module can talk us into.

Definition at line 120 of file relay.h.

◆ max_probes

size_t librats::Relay::Config::max_probes = 3

Peers asked whether they hold a target, per attempt.

Small: each probe is a question to somebody who probably cannot help, and one useful answer is all an attempt needs.

Definition at line 116 of file relay.h.

◆ open_timeout

std::chrono::milliseconds librats::Relay::Config::open_timeout {8000}

How long an attempt may take from the first probe to a live connection.

Covers the probe round trip, the circuit setup, and the handshake across two hops.

Definition at line 125 of file relay.h.

◆ request_budget

size_t librats::Relay::Config::request_budget = 8

Requests (probes and circuit openings) one peer may make per window.

Definition at line 173 of file relay.h.

◆ request_window

std::chrono::milliseconds librats::Relay::Config::request_window {1000}

Definition at line 174 of file relay.h.

◆ serve

bool librats::Relay::Config::serve = false

Serve as a relay.

OFF by default: unlike a hole-punch rendezvous, this spends real bandwidth on somebody else's connection, so it is opted into rather than assumed. A mesh in which nobody serves cannot relay at all.

Definition at line 145 of file relay.h.

◆ tick

std::chrono::milliseconds librats::Relay::Config::tick {250}

Bookkeeping cadence — attempt timeouts, cooldowns, circuit expiry.

Definition at line 190 of file relay.h.

◆ upgrade_with_hole_punch

bool librats::Relay::Config::upgrade_with_hole_punch = true

When a relayed peer connects, ask HolePunch to try it directly, so the circuit is replaced by a direct link as soon as one is possible.

Costs nothing when no HolePunch is attached.

Definition at line 187 of file relay.h.

◆ window

uint32_t librats::Relay::Config::window = Circuit::kDefaultWindow

Bytes this node is willing to have in flight per byte-stream circuit — the credit window it advertises (see transport/relay_link.h).

Raising it makes such a peer faster on a long path and asks the relay to hold more. A circuit whose datagrams the relay forwards has no window.

Definition at line 182 of file relay.h.


The documentation for this struct was generated from the following file: