module

RNS::Reticulum

Main system module for the Reticulum Network Stack.

Holds protocol constants, path configuration, and class-level state for transport, identity, and interface management. Provides the singleton accessor for ReticulumInstance, signal handlers for graceful shutdown, and the default configuration template.

Constants

ANNOUNCE_CAP = 2
CLEAN_INTERVAL = 15 * 60
DEFAULT_LOCAL_CONTROL_PORT = 37429
DEFAULT_LOCAL_INTERFACE_PORT = 37428

─── Default ports ───────────────────────────────────────────────

DEFAULT_PER_HOP_TIMEOUT = 6
DEFAULT_RNS_CONFIG = "# This is the default Reticulum config file.\n# You should probably edit it to include any additional,\n# interfaces and settings you might need.\n\n# Only the most basic options are included in this default\n# configuration. To see a more verbose, and much longer,\n# configuration example, you can run the command:\n# rnsd --exampleconfig\n\n\n[reticulum]\n\n# If you enable Transport, your system will route traffic\n# for other peers, pass announces and serve path requests.\n# This should only be done for systems that are suited to\n# act as transport nodes, ie. if they are stationary and\n# always-on. This directive is optional and can be removed\n# for brevity.\n\nenable_transport = False\n\n\n# By default, the first program to launch the Reticulum\n# Network Stack will create a shared instance, that other\n# programs can communicate with. Only the shared instance\n# opens all the configured interfaces directly, and other\n# local programs communicate with the shared instance over\n# a local socket. This is completely transparent to the\n# user, and should generally be turned on. This directive\n# is optional and can be removed for brevity.\n\nshare_instance = Yes\n\n\n# If you want to run multiple *different* shared instances\n# on the same system, you will need to specify different\n# instance names for each. On platforms supporting domain\n# sockets, this can be done with the instance_name option:\n\ninstance_name = default\n\n\n# Some platforms don't support domain sockets, and if that\n# is the case, you can isolate different instances by\n# specifying a unique set of ports for each:\n\n# shared_instance_port = 37428\n# instance_control_port = 37429\n\n\n# If you want to explicitly use TCP for shared instance\n# communication, instead of domain sockets, this is also\n# possible, by using the following option:\n\n# shared_instance_type = tcp\n\n\n# You can configure whether Reticulum should discover\n# available interfaces from other Transport Instances over\n# the network. If this option is enabled, Reticulum will\n# collect interface information discovered from the network.\n\n# discover_interfaces = No\n\n\n# You can configure Reticulum to panic and forcibly close\n# if an unrecoverable interface error occurs, such as the\n# hardware device for an interface disappearing. This is\n# an optional directive, and can be left out for brevity.\n# This behaviour is disabled by default.\n\n# panic_on_interface_error = No\n\n\n# If you're connecting to a large external network, you\n# can use one or more external blackhole list to block\n# spammy and excessive announces onto your network. This\n# funtionality is especially useful if you're hosting public\n# entrypoints or gateways. The list source below provides a\n# functional example, but better, more timely maintained\n# lists probably exist in the community.\n\n# blackhole_sources = 521c87a83afb8f29e4455e77930b973b\n\n\n[logging]\n# Valid log levels are 0 through 7:\n# 0: Log only critical information\n# 1: Log errors and lower log levels\n# 2: Log warnings and lower log levels\n# 3: Log notices and lower log levels\n# 4: Log info and lower (this is the default)\n# 5: Verbose logging\n# 6: Debug logging\n# 7: Extreme logging\n\nloglevel = 4\n\n\n# The interfaces section defines the physical and virtual\n# interfaces Reticulum will use to communicate on. This\n# section will contain examples for a variety of interface\n# types. You can modify these or use them as a basis for\n# your own config, or simply remove the unused ones.\n\n[interfaces]\n\n # This interface enables communication with other\n # link-local Reticulum nodes over UDP. It does not\n # need any functional IP infrastructure like routers\n # or DHCP servers, but will require that at least link-\n # local IPv6 is enabled in your operating system, which\n # should be enabled by default in almost any OS. See\n # the Reticulum Manual for more configuration options.\n\n [[Default Interface]]\n type = AutoInterface\n enabled = Yes\n"

INI-style default configuration written when no config file exists. Matches the Python reference implementation byte-for-byte.

GRACIOUS_PERSIST_INTERVAL = 60 * 5
HEADER_MAXSIZE = (2 + 1) + ((TRUNCATED_HASHLENGTH // 8) * 2)
HEADER_MINSIZE = (2 + 1) + ((TRUNCATED_HASHLENGTH // 8) * 1)
IFAC_MIN_SIZE = 1
IFAC_SALT = "adf54d882c9a9b80771eb4995d702d4a3e733391b2a0f53f416d9f907e55cff8".hexbytes

IFAC (Interface Authentication Code) salt — must match Python exactly

JOB_INTERVAL = 5 * 60
LINK_MTU_DISCOVERY = true
MAX_QUEUED_ANNOUNCES = 16384
MDU = (MTU - HEADER_MAXSIZE) - IFAC_MIN_SIZE
MINIMUM_BITRATE = 5
MTU = 500

─── Protocol constants ────────────────────────────────────────── Core protocol limits: MTU, announce queue depth, header sizes, and the derived Maximum Data Unit (MDU) available to payloads.

PERSIST_INTERVAL = (60 * 60) * 12
QUEUED_ANNOUNCE_LIFE = (60 * 60) * 24
RESOURCE_CACHE = (24 * 60) * 60

─── Time interval constants ───────────────────────────────────── Intervals (in seconds) for background cache cleaning, data persistence, and resource expiration.

TRUNCATED_HASHLENGTH = 128

Class methods

allow_probes=(v)
Source
autoconnect_discovered_interfaces=(v)
Source
blackhole_sources
Source
blackholepath
Source
blackholepath=(v)
Source
cachepath
Source
cachepath=(v)
Source
configdir
Source
configdir=(v)
Source
configpath
Source
configpath=(v)
Source
default_config_lines

Return the default config as an array of lines (matching Python's splitlines())

Source
discover_interfaces?
Source
discover_interfaces_flag=(v)
Source
discovery_enabled=(v)
Source
discovery_enabled?
Source
exit_handler

Performs graceful shutdown: detaches interfaces, flushes transport state, persists identity data, and silences logging. Safe to call multiple times; only the first invocation has effect.

Source
force_shared_instance_bitrate
Source
force_shared_instance_bitrate=(v)
Source
get_instance

─── Singleton access ────────────────────────────────────────────

Source
identitypath
Source
identitypath=(v)
Source
interface_discovery_sources
Source
interfacepath
Source
interfacepath=(v)
Source
max_autoconnected_interfaces
Source
network_identity
Source
network_identity=(v)
Source
panic_on_interface_error

─── Class-level accessors ───────────────────────────────────────

Source
panic_on_interface_error=(v)
Source
probe_destination_enabled?
Source
publish_blackhole=(v)
Source
publish_blackhole_enabled?
Source
remote_management_enabled=(v)
Source
remote_management_enabled?
Source
required_discovery_value
Source
required_discovery_value=(v)
Source
reset_instance!

Reset singleton for testing

Source
resourcepath
Source
resourcepath=(v)
Source
should_autoconnect_discovered_interfaces?
Source
should_use_implicit_proof?
Source
sigint_handler
Source
sigterm_handler
Source
storagepath
Source
storagepath=(v)
Source
transport_enabled=(v)
Source
transport_enabled?
Source
use_implicit_proof=(v)
Source
userdir
Source