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

#include <hole_punch.h>

Public Attributes

size_t max_relays = 3
 Peers asked to carry one punch's rendezvous.
 
size_t max_addresses = 4
 Endpoints advertised to the target, and therefore dialed by it.
 
int attempts = 3
 Rendezvous rounds before a target is given up on for cooldown.
 
std::chrono::milliseconds round_timeout {6000}
 How long one round may take from the first Connect to a live connection.
 
std::chrono::milliseconds cooldown {60000}
 How long after giving up before the same target may be punched again.
 
size_t max_sessions = 32
 Concurrent punch sessions.
 
bool enable_relay = true
 Serve as a rendezvous for other peers' punches.
 
size_t relay_budget = 12
 Relay budget: messages one peer may have forwarded per window.
 
std::chrono::milliseconds relay_window {1000}
 
bool skip_when_endpoint_dependent = true
 Refuse to punch when the mesh says our own mapping is per-destination (symmetric NAT): no endpoint we could advertise would be the one the target's packets arrive on, so the burst cannot land.
 
DialProfile profile = DialProfile::punch()
 How hard each punch dial retries its Syn.
 
std::chrono::milliseconds tick {250}
 Session bookkeeping cadence — retries, timeouts, cooldown expiry.
 
bool relay_on_failure = true
 When a punch cannot be attempted at all, or has been given up on, hand the target to RelayService — the next rung down the ladder (see subsystems/relay.h).
 

Detailed Description

Definition at line 118 of file hole_punch.h.

Member Data Documentation

◆ attempts

int librats::HolePunch::Config::attempts = 3

Rendezvous rounds before a target is given up on for cooldown.

Definition at line 130 of file hole_punch.h.

◆ cooldown

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

How long after giving up before the same target may be punched again.

Only a rendezvous WE opened ever ends in one: a round we merely answered timing out says nothing about the target, and calling it off there would silently drop the retries the initiator is already sending.

Definition at line 140 of file hole_punch.h.

◆ enable_relay

bool librats::HolePunch::Config::enable_relay = true

Serve as a rendezvous for other peers' punches.

Cheap (a few dozen bytes forwarded per punch) but it is still work done on somebody else's behalf, so it is a choice rather than an assumption.

Definition at line 149 of file hole_punch.h.

◆ max_addresses

size_t librats::HolePunch::Config::max_addresses = 4

Endpoints advertised to the target, and therefore dialed by it.

Capped: this is the fan-out one peer's claim can make us produce.

Definition at line 127 of file hole_punch.h.

◆ max_relays

size_t librats::HolePunch::Config::max_relays = 3

Peers asked to carry one punch's rendezvous.

More than one because we cannot know which of our peers also has the target; each relay that does not simply drops the request. Small, because every extra relay is a duplicate rendezvous the target has to recognise and ignore.

Definition at line 123 of file hole_punch.h.

◆ max_sessions

size_t librats::HolePunch::Config::max_sessions = 32

Concurrent punch sessions.

Bounds both memory and how many dial bursts this node can be talked into producing at once.

Definition at line 144 of file hole_punch.h.

◆ profile

DialProfile librats::HolePunch::Config::profile = DialProfile::punch()

How hard each punch dial retries its Syn.

Definition at line 164 of file hole_punch.h.

◆ relay_budget

size_t librats::HolePunch::Config::relay_budget = 12

Relay budget: messages one peer may have forwarded per window.

A punch costs two forwarded messages per round, so the default leaves generous room for honest use while capping what one peer can spend us.

Definition at line 154 of file hole_punch.h.

◆ relay_on_failure

bool librats::HolePunch::Config::relay_on_failure = true

When a punch cannot be attempted at all, or has been given up on, hand the target to RelayService — the next rung down the ladder (see subsystems/relay.h).

Costs nothing when no Relay is attached: the service simply does not resolve.

Definition at line 173 of file hole_punch.h.

◆ relay_window

std::chrono::milliseconds librats::HolePunch::Config::relay_window {1000}

Definition at line 155 of file hole_punch.h.

◆ round_timeout

std::chrono::milliseconds librats::HolePunch::Config::round_timeout {6000}

How long one round may take from the first Connect to a live connection.

Covers two relayed hops plus the punch burst itself.

Definition at line 134 of file hole_punch.h.

◆ skip_when_endpoint_dependent

bool librats::HolePunch::Config::skip_when_endpoint_dependent = true

Refuse to punch when the mesh says our own mapping is per-destination (symmetric NAT): no endpoint we could advertise would be the one the target's packets arrive on, so the burst cannot land.

Turn off only to try anyway (a NAT can be misclassified by an unlucky sample).

Definition at line 161 of file hole_punch.h.

◆ tick

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

Session bookkeeping cadence — retries, timeouts, cooldown expiry.

Definition at line 167 of file hole_punch.h.


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