Back to Site
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2
7
8#include "librats/util/rats_export.h"
9#include "librats/core/types.h" // TransportKind, CongestionAlgorithm
10
11#include <chrono>
12#include <cstdint>
13#include <string>
14
15namespace librats {
16
17struct RATS_API NodeConfig {
21 uint16_t listen_port = 0;
22 bool enable_listen = true;
23
24 // ── Transports ──────────────────────────────────────────────────────────
25 //
26 // TCP and UDP are equal citizens here: the same Noise handshake, the same
27 // messages, the same guarantees. They differ in how the messages travel — as
28 // blocks over the kernel's TCP stream, or as the library's own QUIC-shaped
29 // packets on one shared socket (transport/udp_connection.h). A node normally
30 // offers both and lets each dial pick.
31
33 bool enable_tcp = true;
37 bool enable_udp = true;
38
48 TransportKind preferred_transport = TransportKind::Udp;
49
54 uint32_t transport_fallback_ms = 1200;
55
62 CongestionAlgorithm congestion_control = CongestionAlgorithm::Bbr;
63
73
80
85 std::chrono::milliseconds udp_idle_timeout{0};
86
93 bool udp_offload = true;
94
112
118 uint32_t path_sample_ms = 0;
119
128 std::string bind_address = "";
129
132 size_t reactor_threads = 1;
133
138 size_t max_peers = 0;
139
141 enum class Security { Noise, Plaintext };
143
150 std::string protocol = "librats/1.0";
151
155 std::string data_dir = "";
156
162};
163
164} // namespace librats
Definition node.h:75
size_t udp_receive_budget
Bytes all UDP connections together may hold out of order.
Definition config.h:79
size_t send_queue_limit
Bytes a peer's send queue may hold before an application that keeps sending anyway has the peer dropp...
Definition config.h:111
std::string bind_address
Interface to bind the listener to.
Definition config.h:128
bool enable_udp
Accept and dial over the datagram transport.
Definition config.h:37
Security security
Definition config.h:142
size_t reactor_threads
Number of reactor threads.
Definition config.h:132
uint16_t listen_port
Listen port for inbound peers.
Definition config.h:21
uint32_t path_sample_ms
How often each established peer's path is sampled for on_peer_path and path_stats() (see PathStats).
Definition config.h:118
uint32_t transport_fallback_ms
How long the preferred transport dials alone before the other one is raced alongside it.
Definition config.h:54
CongestionAlgorithm congestion_control
Congestion controller every datagram stream runs.
Definition config.h:62
std::string protocol
Application protocol identity, bound into the Noise handshake prologue, so two nodes whose protocol d...
Definition config.h:150
size_t udp_receive_window
Bytes one UDP connection's flow-control window may grow to.
Definition config.h:72
std::string data_dir
Directory for persistent state.
Definition config.h:155
bool enable_network_monitor
Watch the host for network configuration changes (interface up/down, IP add/remove,...
Definition config.h:161
Security
Secure channel to use for peer connections.
Definition config.h:141
std::chrono::milliseconds udp_idle_timeout
Silence from a peer after which its UDP connection is closed as lost (CloseReason::IdleTimeout); keep...
Definition config.h:85
bool enable_tcp
Accept and dial over TCP.
Definition config.h:33
bool udp_offload
Whether UDP uses the kernel's segmentation offload where the running system has it (Linux UDP_SEGMENT...
Definition config.h:93
TransportKind preferred_transport
Which transport a dial tries first.
Definition config.h:48
size_t max_peers
Maximum number of established peers.
Definition config.h:138