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

#include <dht_discovery.h>

Collaboration diagram for librats::DhtDiscovery::Config:
[legend]

Public Attributes

uint16_t dht_port = 0
 0 = ephemeral
 
std::string bind_address = ""
 
std::string data_dir = ""
 routing-table persistence dir (empty = cwd). Set to the node's data_dir to co-locate state.
 
bool enable_ipv4 = true
 run the IPv4 Kademlia network
 
bool enable_ipv6 = true
 run the IPv6 Kademlia network (BEP 32)
 
std::string discovery_key = ""
 DHT namespace. Empty → the node's protocol (resolved at attach), so peers of the same app/version discover each other and mismatched protocols (which can't handshake anyway) don't even meet. Set non-empty to override with a custom discovery network.
 
std::vector< HostEndpoint > bootstrap_nodes
 empty → default internet nodes
 
std::chrono::milliseconds search_interval {30000}
 
std::chrono::milliseconds announce_interval {600000}
 every 30 seconds
 
bool discover_external_ip = true
 Probe a STUN server once at startup to learn our public IP and seed the DHT node id per BEP 42.
 
std::vector< HostEndpoint > stun_servers
 empty → built-in public defaults
 
std::chrono::milliseconds stun_timeout {3000}
 

Detailed Description

Definition at line 43 of file dht_discovery.h.

Member Data Documentation

◆ announce_interval

std::chrono::milliseconds librats::DhtDiscovery::Config::announce_interval {600000}

every 30 seconds

Re-announce cadence. Kept at ~⅓ of the peer TTL (librats stores announced peers for 30 min, libtorrent ~45 min) so we stay findable with a comfortable margin even if an announce or two is lost — libtorrent's own default is 15 min. A fresh node still announces immediately at startup regardless of this value (see loop()).

Definition at line 56 of file dht_discovery.h.

◆ bind_address

std::string librats::DhtDiscovery::Config::bind_address = ""

Definition at line 45 of file dht_discovery.h.

◆ bootstrap_nodes

std::vector<HostEndpoint> librats::DhtDiscovery::Config::bootstrap_nodes

empty → default internet nodes

Definition at line 50 of file dht_discovery.h.

◆ data_dir

std::string librats::DhtDiscovery::Config::data_dir = ""

routing-table persistence dir (empty = cwd). Set to the node's data_dir to co-locate state.

Definition at line 46 of file dht_discovery.h.

◆ dht_port

uint16_t librats::DhtDiscovery::Config::dht_port = 0

0 = ephemeral

Definition at line 44 of file dht_discovery.h.

◆ discover_external_ip

bool librats::DhtDiscovery::Config::discover_external_ip = true

Probe a STUN server once at startup to learn our public IP and seed the DHT node id per BEP 42.

Without it we still converge via the slower in-DHT "ip" voting, but bootstrap under the wrong node id until then.

Definition at line 61 of file dht_discovery.h.

◆ discovery_key

std::string librats::DhtDiscovery::Config::discovery_key = ""

DHT namespace. Empty → the node's protocol (resolved at attach), so peers of the same app/version discover each other and mismatched protocols (which can't handshake anyway) don't even meet. Set non-empty to override with a custom discovery network.

Definition at line 49 of file dht_discovery.h.

◆ enable_ipv4

bool librats::DhtDiscovery::Config::enable_ipv4 = true

run the IPv4 Kademlia network

Definition at line 47 of file dht_discovery.h.

◆ enable_ipv6

bool librats::DhtDiscovery::Config::enable_ipv6 = true

run the IPv6 Kademlia network (BEP 32)

Definition at line 48 of file dht_discovery.h.

◆ search_interval

std::chrono::milliseconds librats::DhtDiscovery::Config::search_interval {30000}

Definition at line 51 of file dht_discovery.h.

◆ stun_servers

std::vector<HostEndpoint> librats::DhtDiscovery::Config::stun_servers

empty → built-in public defaults

Definition at line 62 of file dht_discovery.h.

◆ stun_timeout

std::chrono::milliseconds librats::DhtDiscovery::Config::stun_timeout {3000}

Definition at line 63 of file dht_discovery.h.


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