llarp

[crypto.hpp] More...

Namespaces

Name
llarp::aligned_detail
llarp::bencode_detail
llarp::bits
llarp::config
llarp::consensus
llarp::constants
llarp::detail
llarp::dht
llarp::dns
llarp::dtls
llarp::exit
llarp::handlers
llarp::io_uring
llarp::iwp
llarp::linux
llarp::log
llarp::log_detail
llarp::logging
llarp::net
llarp::path
llarp::platform
namespace for platform feature detection constexprs
llarp::quic
llarp::routing
llarp::service
llarp::simulate
llarp::sodium
llarp::sys
llarp::thread
llarp::util
llarp::uv
llarp::vpn
llarp::win32

Classes

Name
struct llarp::AbstractRouter
struct llarp::AddressInfo
struct llarp::AlignedBuffer
aligned buffer that is sz bytes long and aligns to the nearest Alignment
struct llarp::ApiConfig
struct llarp::AsyncFrameDecrypter
struct llarp::BootstrapConfig
struct llarp::BootstrapList
struct llarp::buffer_printer
struct llarp::CaselessLessThan
struct llarp::ComparePtr
type for comparing smart pointer's managed values
struct llarp::CompareWeakPtr
type for comparing weak_ptr by value
struct llarp::Config
struct llarp::ConfigDefinition
A ConfigDefinition holds an ordered set of OptionDefinitions defining the allowable values and their constraints (specified through calls to defineOption()).
struct llarp::ConfigGenParameters
Small struct to gather all parameters needed for config generation to reduce the number of parameters that need to be passed around.
struct llarp::ConfigParser
struct llarp::ConnectConfig
struct llarp::Crypto
library crypto configuration
struct llarp::CryptoManager
struct llarp::CSRNG
rng type that uses llarp::randint(), which is cryptographically secure
struct llarp::DHTImmediateMessage
struct llarp::DiscardMessage
struct llarp::DnsConfig
struct llarp::Encrypted
encrypted buffer base type
struct llarp::EncryptedFrame
class llarp::EndpointBase
class llarp::EventLoop
class llarp::EventLoopPoller
Abstract type to poll on a file descriptor on the event loop.
class llarp::EventLoopRepeater
holds a repeated task on the event loop; the task is removed on destruction
class llarp::EventLoopWakeup
distinct event loop waker upper; used to idempotently schedule a task on the next event loop
class llarp::EventLoopWork
thread pool work item
struct llarp::ExitInfo
deprecated don't use me , this is only for backwards compat
struct llarp::huint_t
struct llarp::I_RCGossiper
struct llarp::I_RCLookupHandler
struct llarp::IdentitySecret
IdentitySecret is a secret key from a service node secret seed.
struct llarp::ILinkLayer
struct llarp::ILinkManager
struct llarp::ILinkMessage
parsed link layer message
struct llarp::ILinkSession
struct llarp::IOutboundMessageHandler
struct llarp::IOutboundSessionMaker
struct llarp::IPRange
struct llarp::is_scoped_enum
struct llarp::is_scoped_enum< T, true >
struct llarp::KeyManager
KeyManager manages the cryptographic keys stored on disk for the local node.
struct llarp::LinkFactory
LinkFactory is responsible for returning std::functions that create the link layer types.
struct llarp::LinkIntroMessage
struct llarp::LinkManager
struct llarp::LinkMessageParser
struct llarp::LinksConfig
struct llarp::LogDebug
struct llarp::LogError
struct llarp::LoggingConfig
struct llarp::LogInfo
struct llarp::LogTrace
struct llarp::LogWarn
struct llarp::LR_CommitMessage
struct llarp::LR_CommitRecord
struct llarp::LR_StatusMessage
struct llarp::LR_StatusRecord
struct llarp::NetID
NetID.
struct llarp::NetworkConfig
class llarp::NodeDB
struct llarp::nuint_t
struct llarp::OptionDefinition
The primary type-aware implementation of OptionDefinitionBase, this templated class allows for implementations which can use fmt::format for conversion to string and std::istringstream for input from string.
struct llarp::OptionDefinitionBase
A base class for specifying config options and their constraints.
struct llarp::OutboundMessageHandler
struct llarp::OutboundSessionMaker
struct llarp::OwnedBuffer
struct llarp::PathID_t
struct llarp::PeerSelectionConfig
config for path hop selection
struct llarp::PrivateKey
PrivateKey is similar to SecretKey except that it only stores the private key value and a hash, unlike SecretKey which stores the seed from which the private key and hash value are generated.
struct llarp::Profiling
struct llarp::PubKey
struct llarp::RCGossiper
struct llarp::RCLookupHandler
struct llarp::RelayDownstreamMessage
struct llarp::RelayUpstreamMessage
struct llarp::RoutePoker
struct llarp::Router
struct llarp::RouterConfig
struct llarp::RouterContact
RouterContact.
struct llarp::RouterID
struct llarp::RouterProfile
struct llarp::RouterVersion
struct llarp::SecretKey
Stores a sodium "secret key" value, which is actually the seed concatenated with the public key.
struct llarp::SessionStats
struct llarp::Signature
struct llarp::SockAddr
A simple SockAddr wrapper which provides a sockaddr_in (IPv4).
struct llarp::UDPHandle
struct llarp::uint128_t
128-bit unsigned integer.

Types

Name
enum class SendStatus { Success, Timeout, NoLink, InvalidRouter, RouterNotFound, Congestion}
enum class SessionResult { Establish, Timeout, RouterNotFound, InvalidRouter, NoLink, EstablishFail}
enum class RCRequestResult { Success, InvalidRouter, RouterNotFound, BadRC}
using llarp::ConfigParser::SectionValues_t SectionValues_t
using llarp::ConfigParser::Config_impl_t Config_impl_t
using std::function< void(std::string_view section, std::string_view name, std::string_view value)> UndeclaredValueHandler
using std::unique_ptr< OptionDefinitionBase > OptionDefinition_ptr
using std::unordered_map< std::string, OptionDefinition_ptr > DefinitionMap
using std::unordered_map< std::string, DefinitionMap > SectionMap
using AlignedBuffer< SHAREDKEYSIZE > SharedSecret
using AlignedBuffer< 32 > KeyExchangeNonce
using AlignedBuffer< SHORTHASHSIZE > ShortHash
using AlignedBuffer< HASHSIZE > LongHash
using AlignedBuffer< TUNNONCESIZE > TunnelNonce
using AlignedBuffer< NONCESIZE > SymmNonce
using AlignedBuffer< 32 > SymmKey
using AlignedBuffer< PQ_CIPHERTEXTSIZE+1 > PQCipherBlock
using AlignedBuffer< PQ_PUBKEYSIZE > PQPubKey
using AlignedBuffer< PQ_KEYPAIRSIZE > PQKeyPair
using std::function< bool(SharedSecret &, const PubKey &, const SecretKey &, const TunnelNonce &)> path_dh_func
PKE(result, publickey, secretkey, nonce)
using std::function< bool(SharedSecret &, const PubKey &, const SecretKey &, const TunnelNonce &)> transport_dh_func
TKE(result, publickey, secretkey, nonce)
using std::function< bool(ShortHash &, const llarp_buffer_t &)> shorthash_func
SH(result, body)
using std::shared_ptr< EventLoop > EventLoop_ptr
using std::function< bool(ILinkSession *, const llarp_buffer_t &)> LinkMessageHandler
handle a link layer message.
using std::function< bool(Signature &, const llarp_buffer_t &)> SignBufferFunc
sign a buffer with identity key.
using std::function< void(ILinkSession *)> TimeoutHandler
handle connection timeout
using std::function< const llarp::RouterContact &(void)> GetRCFunc
get our RC
using std::function< bool(ILinkSession *, bool)> SessionEstablishedHandler
handler of session established return false to reject return true to accept
using std::function< bool(llarp::RouterContact, llarp::RouterContact)> SessionRenegotiateHandler
f(new, old) handler of session renegotiation returns true if the new rc is valid returns false otherwise and the session is terminated
using std::function< void(llarp::RouterID)> SessionClosedHandler
handles close of all sessions with pubkey
using std::function< void(void)> PumpDoneHandler
notifies router that a link session has ended its pump and we should flush messages to upper layers
using std::function< void(void)> Work_t
using std::function< void(Work_t)> WorkerFunc_t
queue work to worker thread
using std::function< void(llarp::RouterContact)> BeforeConnectFunc_t
before connection hook, called before we try connecting via outbound link
using std::shared_ptr< ILinkLayer > LinkLayer_ptr
using huint_t< uint32_t > huint32_t
using huint_t< uint16_t > huint16_t
using huint_t< llarp::uint128_t > huint128_t
using llarp::net::port_t nuint16_t
using llarp::net::ipv4addr_t nuint32_t
using llarp::net::ipv6addr_t nuint128_t
using std::function< void(SendStatus)> SendStatusHandler
using std::function< void(const RouterID &, const SessionResult)> RouterCallback
using std::function< void(const RouterID &, const RouterContact *const, const RCRequestResult)> RCRequestCallback
using std::function< void(const std::vector< RouterContact > &)> RouterLookupHandler
using std::shared_ptr< llarp::Context > Node_ptr
typedef std::basic_string_view< byte_t > byte_view_t
using std::chrono::milliseconds Duration_t
using std::chrono::system_clock DateClock_t
using DateClock_t::time_point TimePoint_t

Functions

Name
std::unordered_map< std::string, BootstrapList > load_bootstrap_fallbacks()
void ensureConfig(fs::path dataDir, fs::path confFile, bool overwrite, bool asRouter)
fs::path GetDefaultDataDir()
fs::path GetDefaultConfigFilename()
fs::path GetDefaultConfigPath()
fs::path GetDefaultBootstrap()
uint64_t randint()
return random 64bit unsigned interger
const byte_t * seckey_topublic(const SecretKey & secret)
const byte_t * pq_keypair_to_public(const PQKeyPair & keypair)
const byte_t * pq_keypair_to_secret(const PQKeyPair & keypair)
bool operator==(const PubKey & lhs, const PubKey & rhs)
bool operator==(const PubKey & lhs, const RouterID & rhs)
bool operator==(const RouterID & lhs, const PubKey & rhs)
std::string LRStatusCodeToString(uint64_t status)
bool operator==(const AddressInfo & lhs, const AddressInfo & rhs)
bool operator<(const AddressInfo & lhs, const AddressInfo & rhs)
int cmp(const in_addr & a, const in_addr & b)
int cmp(const in6_addr & a, const in6_addr & b)
template <typename UInt_t >
llarp::nuint_t< UInt_t >
ToNet(llarp::huint_t< UInt_t > x)
template <typename UInt_t >
llarp::huint_t< UInt_t >
ToHost(llarp::nuint_t< UInt_t > x)
net::ipv4addr_t xhtonl(huint32_t x)
constexpr std::string_view ToString(SessionResult sr)
bool operator==(const RouterID & lhs, const RouterID & rhs)
template <typename List_t >
bool
BEncodeReadList(List_t & result, llarp_buffer_t * buf)
bool BEncodeWriteDictMsgType(llarp_buffer_t * buf, const char * k, const char * t)
template <typename Obj_t >
bool
BEncodeWriteDictString(const char * k, const Obj_t & str, llarp_buffer_t * buf)
template <typename Obj_t >
bool
BEncodeWriteDictEntry(const char * k, const Obj_t & o, llarp_buffer_t * buf)
template <typename Int_t >
bool
BEncodeWriteDictInt(const char * k, const Int_t & i, llarp_buffer_t * buf)
template <typename List_t >
bool
BEncodeMaybeReadDictList(const char * k, List_t & item, bool & read, const llarp_buffer_t & key, llarp_buffer_t * buf)
template <typename Item_t >
bool
BEncodeMaybeReadDictEntry(const char * k, Item_t & item, bool & read, const llarp_buffer_t & key, llarp_buffer_t * buf)
template <typename Int_t >
bool
BEncodeMaybeReadDictInt(const char * k, Int_t & i, bool & read, const llarp_buffer_t & key, llarp_buffer_t * buf)
template <typename Item_t >
bool
BEncodeMaybeVerifyVersion(const char * k, Item_t & item, uint64_t expect, bool & read, const llarp_buffer_t & key, llarp_buffer_t * buf)
If the key matches, reads in the version and ensures that it equals the expected version.
template <typename List_t >
bool
BEncodeWriteDictBEncodeList(const char * k, const List_t & l, llarp_buffer_t * buf)
template <typename Array >
bool
BEncodeWriteDictArray(const char * k, const Array & array, llarp_buffer_t * buf)
template <typename Iter >
bool
BEncodeWriteList(Iter itr, Iter end, llarp_buffer_t * buf)
template <typename Sink >
bool
bencode_read_dict(Sink && sink, llarp_buffer_t * buffer)
template <typename Sink >
bool
bencode_decode_dict(Sink && sink, llarp_buffer_t * buff)
template <typename Sink >
bool
bencode_read_list(Sink && sink, llarp_buffer_t * buffer)
template <typename Array >
bool
BEncodeReadArray(Array & array, llarp_buffer_t * buf)
template <typename Set_t >
bool
BEncodeReadSet(Set_t & set, llarp_buffer_t * buffer)
read a std::set of decodable entities and deny duplicates
template <typename Set_t >
bool
BEncodeWriteSet(const Set_t & set, llarp_buffer_t * buffer)
write an iterable container as a list
template <typename List_t >
bool
BEncodeWriteDictList(const char * k, List_t & list, llarp_buffer_t * buf)
template <size_t bufsz,typename T >
void
Dump(const T & val)
template <typename T >
bool
BDecodeReadFile(const fs::path fpath, T & t)
read entire file and decode its contents into t
template <typename T ,size_t bufsz>
bool
BEncodeWriteFile(const fs::path fpath, const T & t)
bencode and write to file
template <typename Int_t >
bool
BEncodeSeekDictVersion(Int_t & v, llarp_buffer_t * buf, const byte_t k)
seek for an int in a dict with a key k used for version set v to parsed value if found this call rewinds the buffer unconditionally before return returns false only if there was
template <typename... T>
LogTrace(T && ...)
template <typename... T>
LogDebug(T && ...)
template <typename... T>
LogInfo(T && ...)
template <typename... T>
LogWarn(T && ...)
template <typename... T>
LogError(T && ...)
void Zero(void * ptr, size_t sz)
template <typename T >
void
dumphex(const uint8_t * t)
template <typename T ,size_t align =128>
void
DumpBufferHex(const T & buff)
template <typename T ,size_t align =128>
void
DumpBuffer(const T & buff)
bool IsFalseValue(std::string_view str)
bool IsTrueValue(std::string_view str)
std::string_view TrimWhitespace(std::string_view str)
Trim leading and trailing (ascii) whitespace from the given string; returns a std::string_view of the trimmed part of the string.
bool string_iequal(std::string_view s1, std::string_view s2)
Returns true if the first string is equal to the second string, compared case-insensitively.
template <typename S1 ,typename... S>
bool
string_iequal_any(const S1 & s1, const S &... s)
Returns true if the first string matches any of the given strings case-insensitively.
constexpr bool starts_with(std::string_view str, std::string_view prefix)
Returns true if the first argument begins with the second argument.
constexpr bool ends_with(std::string_view str, std::string_view suffix)
Returns true if the first argument ends with the second argument.
constexpr std::string_view strip_prefix(std::string_view str, std::string_view prefix)
removes a prefix from a string if it exists
std::vector< std::string_view > split(std::string_view str, std::string_view delim, bool trim =false)
Splits a string on some delimiter string and returns a vector of string_view's pointing into the pieces of the original string.
std::vector< std::string_view > split_any(std::string_view str, std::string_view delims, bool trim =false)
Splits a string on any 1 or more of the given delimiter characters and returns a vector of string_view's pointing into the pieces of the original string.
template <typename It >
std::string
join(std::string_view delimiter, It begin, It end)
Joins [begin, end) with a delimiter and returns the resulting string.
template <typename Container >
std::string
join(std::string_view delimiter, const Container & c)
Wrapper around the above that takes a container and passes c.begin(), c.end() to the above.
void trim(std::string_view & s)
Simple version of whitespace trimming: mutates the given string view to remove leading space, \t, \r, .
template <typename T >
bool
parse_int(const std::string_view str, T & value, int base =10)
Parses an integer of some sort from a string, requiring that the entire string be consumed during parsing.
std::string lowercase_ascii_string(std::string src)
std::string friendly_duration(std::chrono::nanoseconds dur)
Converts a duration into a human friendlier string.
std::wstring to_wide(std::string data)
convert a "normal" string into a wide string
Duration_t time_now_ms()
get time right now as milliseconds, this is monotonic
Duration_t uptime()
get the uptime of the process
llarp_timespec as_timespec(Duration_t )
timespec to_timespec(Duration_t )
uint64_t ToMS(Duration_t duration)
convert to milliseconds
std::string short_time_from_now(const TimePoint_t & t, const Duration_t & now_threshold =1s)
std::string ToString(Duration_t t)

Attributes

Name
constexpr std::size_t event_loop_queue_size
default queue length for logic jobs
constexpr auto our_rc_filename
constexpr auto our_identity_filename
constexpr auto our_enc_key_filename
constexpr auto our_transport_key_filename
constexpr auto nodedb_dirname
constexpr auto TimeskipDetectedDuration
how big of a time skip before we reset network state
const std::array< uint16_t, 3 > VERSION
const std::array< uint64_t, 4 > ROUTER_VERSION
const char *const VERSION_TAG
const char *const VERSION_FULL
const char *const RELEASE_MOTTO
const char *const DEFAULT_NETID
constexpr size_t EncryptedFrameOverheadSize
constexpr size_t EncryptedFrameBodySize
constexpr size_t EncryptedFrameSize
constexpr bool IsToStringFormattable< PubKey >
constexpr bool IsToStringFormattable< SecretKey >
constexpr bool IsToStringFormattable< PrivateKey >
constexpr bool IsToStringFormattable< IdentitySecret >
constexpr bool IsToStringFormattable< AddressInfo >
std::array bogonRanges_v6
std::array bogonRanges_v4
constexpr bool IsToStringFormattable< ExitInfo >
constexpr bool IsToStringFormattable< IPRange >
constexpr bool IsToStringFormattable< huint128_t >
constexpr bool IsToStringFormattable< huint32_t >
constexpr bool IsToStringFormattable< huint16_t >
constexpr bool IsToStringFormattable< SockAddr >
constexpr size_t MaxGossipPeers
The maximum number of peers we will flood a gossiped RC to when propagating an RC.
const size_t MAX_PATH_QUEUE_SIZE
const size_t MAX_OUTBOUND_QUEUE_SIZE
const size_t MAX_OUTBOUND_MESSAGES_PER_TICK
constexpr bool IsToStringFormattable< SessionResult >
constexpr bool IsToStringFormattable< NetID >
constexpr bool IsToStringFormattable< RouterContact >
constexpr bool IsToStringFormattable< RouterID >
constexpr bool IsToStringFormattable< RouterVersion >
constexpr int64_t INVALID_VERSION
const RouterVersion emptyRouterVersion
constexpr bool is_aligned_buffer
constexpr bool IsToStringFormattable
constexpr bool is_scoped_enum_v
constexpr bool IsToStringFormattable< buffer_printer >

Detailed Description

[crypto.hpp]

exit_info.h

[address_info.hpp]

libsodium abstraction layer potentially allow libssl support in the future

utilities for handling addresses on the llarp network address information model

utilities for handling exits on the llarp network Exit info model

Types Documentation

enum SendStatus

Enumerator Value Description
Success
Timeout
NoLink
InvalidRouter
RouterNotFound
Congestion

enum SessionResult

Enumerator Value Description
Establish
Timeout
RouterNotFound
InvalidRouter
NoLink
EstablishFail

enum RCRequestResult

Enumerator Value Description
Success
InvalidRouter
RouterNotFound
BadRC

using SectionValues_t

using llarp::SectionValues_t = typedef llarp::ConfigParser::SectionValues_t;

using Config_impl_t

using llarp::Config_impl_t = typedef llarp::ConfigParser::Config_impl_t;

using UndeclaredValueHandler

using llarp::UndeclaredValueHandler = typedef std::function<void(std::string_view section, std::string_view name, std::string_view value)>;

using OptionDefinition_ptr

using llarp::OptionDefinition_ptr = typedef std::unique_ptr<OptionDefinitionBase>;

using DefinitionMap

using llarp::DefinitionMap = typedef std::unordered_map<std::string, OptionDefinition_ptr>;

using SectionMap

using llarp::SectionMap = typedef std::unordered_map<std::string, DefinitionMap>;

using SharedSecret

using llarp::SharedSecret = typedef AlignedBuffer<SHAREDKEYSIZE>;

using KeyExchangeNonce

using llarp::KeyExchangeNonce = typedef AlignedBuffer<32>;

using ShortHash

using llarp::ShortHash = typedef AlignedBuffer<SHORTHASHSIZE>;

using LongHash

using llarp::LongHash = typedef AlignedBuffer<HASHSIZE>;

using TunnelNonce

using llarp::TunnelNonce = typedef AlignedBuffer<TUNNONCESIZE>;

using SymmNonce

using llarp::SymmNonce = typedef AlignedBuffer<NONCESIZE>;

using SymmKey

using llarp::SymmKey = typedef AlignedBuffer<32>;

using PQCipherBlock

using llarp::PQCipherBlock = typedef AlignedBuffer<PQ_CIPHERTEXTSIZE + 1>;

using PQPubKey

using llarp::PQPubKey = typedef AlignedBuffer<PQ_PUBKEYSIZE>;

using PQKeyPair

using llarp::PQKeyPair = typedef AlignedBuffer<PQ_KEYPAIRSIZE>;

using path_dh_func

using llarp::path_dh_func = typedef std::function<bool(SharedSecret&, const PubKey&, const SecretKey&, const TunnelNonce&)>;

PKE(result, publickey, secretkey, nonce)

using transport_dh_func

using llarp::transport_dh_func = typedef std::function<bool(SharedSecret&, const PubKey&, const SecretKey&, const TunnelNonce&)>;

TKE(result, publickey, secretkey, nonce)

using shorthash_func

using llarp::shorthash_func = typedef std::function<bool(ShortHash&, const llarp_buffer_t&)>;

SH(result, body)

using EventLoop_ptr

using llarp::EventLoop_ptr = typedef std::shared_ptr<EventLoop>;

using LinkMessageHandler

using llarp::LinkMessageHandler = typedef std::function<bool(ILinkSession*, const llarp_buffer_t&)>;

handle a link layer message.

this allows for the message to be handled by "upper layers"

currently called from iwp::Session when messages are sent or received.

using SignBufferFunc

using llarp::SignBufferFunc = typedef std::function<bool(Signature&, const llarp_buffer_t&)>;

sign a buffer with identity key.

this function should take the given [llarp_buffer_t](/llarp/Classes/structllarp__buffer__t) and sign it, prividing the signature in the out variable [Signature](/llarp/Classes/structllarp_1_1Signature)&.

currently called from iwp::Session for signing LIMs (link introduction messages)

using TimeoutHandler

using llarp::TimeoutHandler = typedef std::function<void(ILinkSession*)>;

handle connection timeout

currently called from ILinkLayer::Pump() when an unestablished session times out

using GetRCFunc

using llarp::GetRCFunc = typedef std::function<const llarp::RouterContact&(void)>;

get our RC

currently called by iwp::Session to include as part of a LIM (link introduction message)

using SessionEstablishedHandler

using llarp::SessionEstablishedHandler = typedef std::function<bool(ILinkSession*, bool)>;

handler of session established return false to reject return true to accept

currently called in iwp::Session when a valid LIM is received.

using SessionRenegotiateHandler

using llarp::SessionRenegotiateHandler = typedef std::function<bool(llarp::RouterContact, llarp::RouterContact)>;

f(new, old) handler of session renegotiation returns true if the new rc is valid returns false otherwise and the session is terminated

currently called from iwp::Session when we receive a renegotiation LIM

using SessionClosedHandler

using llarp::SessionClosedHandler = typedef std::function<void(llarp::RouterID)>;

handles close of all sessions with pubkey

Note that this handler is called while m_AuthedLinksMutex is held

currently called from iwp::ILinkSession when a previously established session times out

using PumpDoneHandler

using llarp::PumpDoneHandler = typedef std::function<void(void)>;

notifies router that a link session has ended its pump and we should flush messages to upper layers

currently called at the end of every iwp::Session::Pump() call

using Work_t

using llarp::Work_t = typedef std::function<void(void)>;

using WorkerFunc_t

using llarp::WorkerFunc_t = typedef std::function<void(Work_t)>;

queue work to worker thread

using BeforeConnectFunc_t

using llarp::BeforeConnectFunc_t = typedef std::function<void(llarp::RouterContact)>;

before connection hook, called before we try connecting via outbound link

using LinkLayer_ptr

using llarp::LinkLayer_ptr = typedef std::shared_ptr<ILinkLayer>;

using huint32_t

using llarp::huint32_t = typedef huint_t<uint32_t>;

using huint16_t

using llarp::huint16_t = typedef huint_t<uint16_t>;

using huint128_t

using llarp::huint128_t = typedef huint_t<llarp::uint128_t>;

using nuint16_t

using llarp::nuint16_t = typedef llarp::net::port_t;

using nuint32_t

using llarp::nuint32_t = typedef llarp::net::ipv4addr_t;

using nuint128_t

using llarp::nuint128_t = typedef llarp::net::ipv6addr_t;

using SendStatusHandler

using llarp::SendStatusHandler = typedef std::function<void(SendStatus)>;

using RouterCallback

using llarp::RouterCallback = typedef std::function<void(const RouterID&, const SessionResult)>;

using RCRequestCallback

using llarp::RCRequestCallback = typedef std::function<void(const RouterID&, const RouterContact* const, const RCRequestResult)>;

using RouterLookupHandler

using llarp::RouterLookupHandler = typedef std::function<void(const std::vector<RouterContact>&)>;

using Node_ptr

using llarp::Node_ptr = typedef std::shared_ptr<llarp::Context>;

typedef byte_view_t

typedef std::basic_string_view< byte_t > llarp::byte_view_t;

using Duration_t

using llarp::Duration_t = typedef std::chrono::milliseconds;

using DateClock_t

using llarp::DateClock_t = typedef std::chrono::system_clock;

using TimePoint_t

using llarp::TimePoint_t = typedef DateClock_t::time_point;

Functions Documentation

function load_bootstrap_fallbacks

std::unordered_map< std::string, BootstrapList > load_bootstrap_fallbacks()

function ensureConfig

void ensureConfig(
    fs::path dataDir,
    fs::path confFile,
    bool overwrite,
    bool asRouter
)

function GetDefaultDataDir

inline fs::path GetDefaultDataDir()

function GetDefaultConfigFilename

inline fs::path GetDefaultConfigFilename()

function GetDefaultConfigPath

inline fs::path GetDefaultConfigPath()

function GetDefaultBootstrap

inline fs::path GetDefaultBootstrap()

function randint

uint64_t randint()

return random 64bit unsigned interger

function seckey_topublic

const byte_t * seckey_topublic(
    const SecretKey & secret
)

function pq_keypair_to_public

const byte_t * pq_keypair_to_public(
    const PQKeyPair & keypair
)

function pq_keypair_to_secret

const byte_t * pq_keypair_to_secret(
    const PQKeyPair & keypair
)

function operator==

inline bool operator==(
    const PubKey & lhs,
    const PubKey & rhs
)

function operator==

inline bool operator==(
    const PubKey & lhs,
    const RouterID & rhs
)

function operator==

inline bool operator==(
    const RouterID & lhs,
    const PubKey & rhs
)

function LRStatusCodeToString

std::string LRStatusCodeToString(
    uint64_t status
)

function operator==

bool operator==(
    const AddressInfo & lhs,
    const AddressInfo & rhs
)

function operator<

bool operator<(
    const AddressInfo & lhs,
    const AddressInfo & rhs
)

function cmp

inline int cmp(
    const in_addr & a,
    const in_addr & b
)

function cmp

inline int cmp(
    const in6_addr & a,
    const in6_addr & b
)

function ToNet

template <typename UInt_t >
inline llarp::nuint_t< UInt_t > ToNet(
    llarp::huint_t< UInt_t > x
)

function ToHost

template <typename UInt_t >
inline llarp::huint_t< UInt_t > ToHost(
    llarp::nuint_t< UInt_t > x
)

function xhtonl

inline net::ipv4addr_t xhtonl(
    huint32_t x
)

function ToString

constexpr std::string_view ToString(
    SessionResult sr
)

function operator==

inline bool operator==(
    const RouterID & lhs,
    const RouterID & rhs
)

function BEncodeReadList

template <typename List_t >
bool BEncodeReadList(
    List_t & result,
    llarp_buffer_t * buf
)

function BEncodeWriteDictMsgType

inline bool BEncodeWriteDictMsgType(
    llarp_buffer_t * buf,
    const char * k,
    const char * t
)

function BEncodeWriteDictString

template <typename Obj_t >
bool BEncodeWriteDictString(
    const char * k,
    const Obj_t & str,
    llarp_buffer_t * buf
)

function BEncodeWriteDictEntry

template <typename Obj_t >
bool BEncodeWriteDictEntry(
    const char * k,
    const Obj_t & o,
    llarp_buffer_t * buf
)

function BEncodeWriteDictInt

template <typename Int_t >
bool BEncodeWriteDictInt(
    const char * k,
    const Int_t & i,
    llarp_buffer_t * buf
)

function BEncodeMaybeReadDictList

template <typename List_t >
bool BEncodeMaybeReadDictList(
    const char * k,
    List_t & item,
    bool & read,
    const llarp_buffer_t & key,
    llarp_buffer_t * buf
)

function BEncodeMaybeReadDictEntry

template <typename Item_t >
bool BEncodeMaybeReadDictEntry(
    const char * k,
    Item_t & item,
    bool & read,
    const llarp_buffer_t & key,
    llarp_buffer_t * buf
)

function BEncodeMaybeReadDictInt

template <typename Int_t >
bool BEncodeMaybeReadDictInt(
    const char * k,
    Int_t & i,
    bool & read,
    const llarp_buffer_t & key,
    llarp_buffer_t * buf
)

function BEncodeMaybeVerifyVersion

template <typename Item_t >
bool BEncodeMaybeVerifyVersion(
    const char * k,
    Item_t & item,
    uint64_t expect,
    bool & read,
    const llarp_buffer_t & key,
    llarp_buffer_t * buf
)

If the key matches, reads in the version and ensures that it equals the expected version.

function BEncodeWriteDictBEncodeList

template <typename List_t >
bool BEncodeWriteDictBEncodeList(
    const char * k,
    const List_t & l,
    llarp_buffer_t * buf
)

function BEncodeWriteDictArray

template <typename Array >
bool BEncodeWriteDictArray(
    const char * k,
    const Array & array,
    llarp_buffer_t * buf
)

function BEncodeWriteList

template <typename Iter >
bool BEncodeWriteList(
    Iter itr,
    Iter end,
    llarp_buffer_t * buf
)

function bencode_read_dict

template <typename Sink >
bool bencode_read_dict(
    Sink && sink,
    llarp_buffer_t * buffer
)

function bencode_decode_dict

template <typename Sink >
bool bencode_decode_dict(
    Sink && sink,
    llarp_buffer_t * buff
)

function bencode_read_list

template <typename Sink >
bool bencode_read_list(
    Sink && sink,
    llarp_buffer_t * buffer
)

function BEncodeReadArray

template <typename Array >
bool BEncodeReadArray(
    Array & array,
    llarp_buffer_t * buf
)

function BEncodeReadSet

template <typename Set_t >
bool BEncodeReadSet(
    Set_t & set,
    llarp_buffer_t * buffer
)

read a std::set of decodable entities and deny duplicates

function BEncodeWriteSet

template <typename Set_t >
bool BEncodeWriteSet(
    const Set_t & set,
    llarp_buffer_t * buffer
)

write an iterable container as a list

function BEncodeWriteDictList

template <typename List_t >
bool BEncodeWriteDictList(
    const char * k,
    List_t & list,
    llarp_buffer_t * buf
)

function Dump

template <size_t bufsz,
typename T >
void Dump(
    const T & val
)

function BDecodeReadFile

template <typename T >
bool BDecodeReadFile(
    const fs::path fpath,
    T & t
)

read entire file and decode its contents into t

function BEncodeWriteFile

template <typename T ,
size_t bufsz>
bool BEncodeWriteFile(
    const fs::path fpath,
    const T & t
)

bencode and write to file

function BEncodeSeekDictVersion

template <typename Int_t >
bool BEncodeSeekDictVersion(
    Int_t & v,
    llarp_buffer_t * buf,
    const byte_t k
)

seek for an int in a dict with a key k used for version set v to parsed value if found this call rewinds the buffer unconditionally before return returns false only if there was

function LogTrace

template <typename... T>
LogTrace(
    T && ...
)

function LogDebug

template <typename... T>
LogDebug(
    T && ...
)

function LogInfo

template <typename... T>
LogInfo(
    T && ...
)

function LogWarn

template <typename... T>
LogWarn(
    T && ...
)

function LogError

template <typename... T>
LogError(
    T && ...
)

function Zero

void Zero(
    void * ptr,
    size_t sz
)

function dumphex

template <typename T >
void dumphex(
    const uint8_t * t
)

function DumpBufferHex

template <typename T ,
size_t align =128>
void DumpBufferHex(
    const T & buff
)

function DumpBuffer

template <typename T ,
size_t align =128>
void DumpBuffer(
    const T & buff
)

function IsFalseValue

bool IsFalseValue(
    std::string_view str
)

function IsTrueValue

bool IsTrueValue(
    std::string_view str
)

function TrimWhitespace

std::string_view TrimWhitespace(
    std::string_view str
)

Trim leading and trailing (ascii) whitespace from the given string; returns a std::string_view of the trimmed part of the string.

function string_iequal

inline bool string_iequal(
    std::string_view s1,
    std::string_view s2
)

Returns true if the first string is equal to the second string, compared case-insensitively.

function string_iequal_any

template <typename S1 ,
typename... S>
bool string_iequal_any(
    const S1 & s1,
    const S &... s
)

Returns true if the first string matches any of the given strings case-insensitively.

Arguments must be string literals, std::string, or std::string_views

function starts_with

inline constexpr bool starts_with(
    std::string_view str,
    std::string_view prefix
)

Returns true if the first argument begins with the second argument.

function ends_with

inline constexpr bool ends_with(
    std::string_view str,
    std::string_view suffix
)

Returns true if the first argument ends with the second argument.

function strip_prefix

inline constexpr std::string_view strip_prefix(
    std::string_view str,
    std::string_view prefix
)

removes a prefix from a string if it exists

function split

std::vector< std::string_view > split(
    std::string_view str,
    std::string_view delim,
    bool trim =false
)

Splits a string on some delimiter string and returns a vector of string_view's pointing into the pieces of the original string.

The pieces are valid only as long as the original string remains valid. Leading and trailing empty substrings are not removed. If delim is empty you get back a vector of string_views each viewing one character. If trim is true then leading and trailing empty values will be suppressed.

auto v = split("ab--c----de", "--"); // v is {"ab", "c", "", "de"}
auto v = split("abc", ""); // v is {"a", "b", "c"}
auto v = split("abc", "c"); // v is {"ab", ""}
auto v = split("abc", "c", true); // v is {"ab"}
auto v = split("-a--b--", "-"); // v is {"", "a", "", "b", "", ""}
auto v = split("-a--b--", "-", true); // v is {"a", "", "b"}

function split_any

std::vector< std::string_view > split_any(
    std::string_view str,
    std::string_view delims,
    bool trim =false
)

Splits a string on any 1 or more of the given delimiter characters and returns a vector of string_view's pointing into the pieces of the original string.

If delims is empty this works the same as split(). trim works like split (suppresses leading and trailing empty string pieces).

auto v = split_any("abcdedf", "dcx"); // v is {"ab", "e", "f"} 

function join

template <typename It >
std::string join(
    std::string_view delimiter,
    It begin,
    It end
)

Joins [begin, end) with a delimiter and returns the resulting string.

Elements can be anything that is fmt formattable.

function join

template <typename Container >
std::string join(
    std::string_view delimiter,
    const Container & c
)

Wrapper around the above that takes a container and passes c.begin(), c.end() to the above.

function trim

void trim(
    std::string_view & s
)

Simple version of whitespace trimming: mutates the given string view to remove leading space, \t, \r, .

(More exotic and locale-dependent whitespace is not removed).

function parse_int

template <typename T >
bool parse_int(
    const std::string_view str,
    T & value,
    int base =10
)

Parses an integer of some sort from a string, requiring that the entire string be consumed during parsing.

Return false if parsing failed, sets value and returns true if the entire string was consumed.

function lowercase_ascii_string

std::string lowercase_ascii_string(
    std::string src
)

function friendly_duration

std::string friendly_duration(
    std::chrono::nanoseconds dur
)

Converts a duration into a human friendlier string.

function to_wide

std::wstring to_wide(
    std::string data
)

convert a "normal" string into a wide string

function time_now_ms

Duration_t time_now_ms()

get time right now as milliseconds, this is monotonic

function uptime

Duration_t uptime()

get the uptime of the process

function as_timespec

llarp_timespec as_timespec(
    Duration_t 
)

function to_timespec

timespec to_timespec(
    Duration_t 
)

function ToMS

uint64_t ToMS(
    Duration_t duration
)

convert to milliseconds

function short_time_from_now

std::string short_time_from_now(
    const TimePoint_t & t,
    const Duration_t & now_threshold =1s
)

function ToString

std::string ToString(
    Duration_t t
)

Attributes Documentation

variable event_loop_queue_size

constexpr std::size_t event_loop_queue_size = 1024;

default queue length for logic jobs

variable our_rc_filename

constexpr auto our_rc_filename = "self.signed";

variable our_identity_filename

constexpr auto our_identity_filename = "identity.key";

variable our_enc_key_filename

constexpr auto our_enc_key_filename = "encryption.key";

variable our_transport_key_filename

constexpr auto our_transport_key_filename = "transport.key";

variable nodedb_dirname

constexpr auto nodedb_dirname = "nodedb";

variable TimeskipDetectedDuration

constexpr auto TimeskipDetectedDuration = 1min;

how big of a time skip before we reset network state

variable VERSION

const std::array< uint16_t, 3 > VERSION;

variable ROUTER_VERSION

const std::array< uint64_t, 4 > ROUTER_VERSION;

variable VERSION_TAG

const char *const VERSION_TAG;

variable VERSION_FULL

const char *const VERSION_FULL;

variable RELEASE_MOTTO

const char *const RELEASE_MOTTO;

variable DEFAULT_NETID

const char *const DEFAULT_NETID;

variable EncryptedFrameOverheadSize

static constexpr size_t EncryptedFrameOverheadSize = PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE;

variable EncryptedFrameBodySize

static constexpr size_t EncryptedFrameBodySize = 128 * 6;

variable EncryptedFrameSize

static constexpr size_t EncryptedFrameSize = EncryptedFrameOverheadSize + EncryptedFrameBodySize;

variable IsToStringFormattable< PubKey >

constexpr bool IsToStringFormattable< PubKey > = true;

variable IsToStringFormattable< SecretKey >

constexpr bool IsToStringFormattable< SecretKey > = true;

variable IsToStringFormattable< PrivateKey >

constexpr bool IsToStringFormattable< PrivateKey > = true;

variable IsToStringFormattable< IdentitySecret >

constexpr bool IsToStringFormattable< IdentitySecret > = true;

variable IsToStringFormattable< AddressInfo >

constexpr bool IsToStringFormattable< AddressInfo > = true;

variable bogonRanges_v6

static std::array bogonRanges_v6 = {

      IPRange{ToNet(huint128_t{0}), net::netmask_ipv6_bits(128)},

      IPRange{ToNet(huint128_t{1}), net::netmask_ipv6_bits(128)},

      IPRange{
          ToNet(huint128_t{uint128_t{0x0200'0000'0000'0000UL, 0UL}}), net::netmask_ipv6_bits(7)},

      IPRange{
          ToNet(huint128_t{uint128_t{0xff00'0000'0000'0000UL, 0UL}}), net::netmask_ipv6_bits(8)},

      IPRange{
          ToNet(huint128_t{uint128_t{0xfc00'0000'0000'0000UL, 0UL}}), net::netmask_ipv6_bits(8)},

      IPRange{
          ToNet(huint128_t{uint128_t{0xf800'0000'0000'0000UL, 0UL}}), net::netmask_ipv6_bits(8)}};

variable bogonRanges_v4

static std::array bogonRanges_v4 = {
      IPRange::FromIPv4(0, 0, 0, 0, 8),
      IPRange::FromIPv4(10, 0, 0, 0, 8),
      IPRange::FromIPv4(100, 64, 0, 0, 10),
      IPRange::FromIPv4(127, 0, 0, 0, 8),
      IPRange::FromIPv4(169, 254, 0, 0, 16),
      IPRange::FromIPv4(172, 16, 0, 0, 12),
      IPRange::FromIPv4(192, 0, 0, 0, 24),
      IPRange::FromIPv4(192, 0, 2, 0, 24),
      IPRange::FromIPv4(192, 88, 99, 0, 24),
      IPRange::FromIPv4(192, 168, 0, 0, 16),
      IPRange::FromIPv4(198, 18, 0, 0, 15),
      IPRange::FromIPv4(198, 51, 100, 0, 24),
      IPRange::FromIPv4(203, 0, 113, 0, 24),
      IPRange::FromIPv4(224, 0, 0, 0, 4),
      IPRange::FromIPv4(240, 0, 0, 0, 4)};

variable IsToStringFormattable< ExitInfo >

constexpr bool IsToStringFormattable< ExitInfo > = true;

variable IsToStringFormattable< IPRange >

constexpr bool IsToStringFormattable< IPRange > = true;

variable IsToStringFormattable< huint128_t >

constexpr bool IsToStringFormattable< huint128_t > = true;

variable IsToStringFormattable< huint32_t >

constexpr bool IsToStringFormattable< huint32_t > = true;

variable IsToStringFormattable< huint16_t >

constexpr bool IsToStringFormattable< huint16_t > = true;

variable IsToStringFormattable< SockAddr >

constexpr bool IsToStringFormattable< SockAddr > = true;

variable MaxGossipPeers

constexpr size_t MaxGossipPeers = 20;

The maximum number of peers we will flood a gossiped RC to when propagating an RC.

variable MAX_PATH_QUEUE_SIZE

static const size_t MAX_PATH_QUEUE_SIZE = 100;

variable MAX_OUTBOUND_QUEUE_SIZE

static const size_t MAX_OUTBOUND_QUEUE_SIZE = 1000;

variable MAX_OUTBOUND_MESSAGES_PER_TICK

static const size_t MAX_OUTBOUND_MESSAGES_PER_TICK = 500;

variable IsToStringFormattable< SessionResult >

constexpr bool IsToStringFormattable< SessionResult > = true;

variable IsToStringFormattable< NetID >

constexpr bool IsToStringFormattable< NetID > = true;

variable IsToStringFormattable< RouterContact >

constexpr bool IsToStringFormattable< RouterContact > = true;

variable IsToStringFormattable< RouterID >

constexpr bool IsToStringFormattable< RouterID > = true;

variable IsToStringFormattable< RouterVersion >

constexpr bool IsToStringFormattable< RouterVersion > = true;

variable INVALID_VERSION

static constexpr int64_t INVALID_VERSION = -1;

variable emptyRouterVersion

static const RouterVersion emptyRouterVersion;

variable is_aligned_buffer

constexpr bool is_aligned_buffer =
      decltype(detail::is_aligned_buffer_impl(static_cast<T*>(nullptr)))::value;

variable IsToStringFormattable

constexpr bool IsToStringFormattable = false;

variable is_scoped_enum_v

constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value;

variable IsToStringFormattable< buffer_printer >

constexpr bool IsToStringFormattable< buffer_printer > = true;

Updated on 2026-01-10 at 22:49:45 +0000