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_bytes_per_circuit = 64ull * 1024 * 1024
 Bytes one circuit may move before it is closed.
 
std::chrono::seconds max_circuit_duration {600}
 How long one circuit may live. 0 removes the cap.
 
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 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 95 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 123 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 117 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 99 of file relay.h.

◆ max_bytes_per_circuit

uint64_t librats::Relay::Config::max_bytes_per_circuit = 64ull * 1024 * 1024

Bytes one circuit may move before it is closed.

0 removes the cap. The default is generous for a fallback path and still bounds what one pair of peers can spend of ours.

Definition at line 145 of file relay.h.

◆ max_circuit_duration

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

How long one circuit may live. 0 removes the cap.

Definition at line 148 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 136 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 140 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 126 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 108 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 104 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 113 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 151 of file relay.h.

◆ request_window

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

Definition at line 152 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 133 of file relay.h.

◆ tick

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

Bookkeeping cadence — attempt timeouts, cooldowns, circuit expiry.

Definition at line 167 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 164 of file relay.h.

◆ window

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

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

Raising it makes a relayed peer faster on a long path and asks the relay to hold more.

Definition at line 159 of file relay.h.


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