Config file improvements (#1397)
* Config file API/comment improvements API improvements: ================= Make the config API use position-independent tag parameters (Required, Default{123}, MultiValue) rather than a sequence of bools with overloads. For example, instead of: conf.defineOption<int>("a", "b", false, true, 123, [] { ... }); you now write: conf.defineOption<int>("a", "b", MultiValue, Default{123}, [] { ... }); The tags are: - Required - MultiValue - Default{value} plus new abilities (see below): - Hidden - RelayOnly - ClientOnly - Comment{"line1", "line2", "line3"} Made option definition more powerful: ===================================== - `Hidden` allows you to define an option that won't show up in the generated config file if it isn't set. - `RelayOnly`/`ClientOnly` sets up an option that is only accepted and only shows up for relay or client configs. (If neither is specified the option shows up in both modes). - `Comment{...}` lets the option comments be specified as part of the defineOption. Comment improvements ==================== - Rewrote comments for various options to expand on details. - Inlined all the comments with the option definitions. - Several options that were missing comments got comments added. - Made various options for deprecated and or internal options hidden by default so that they don't show up in a default config file. - show the section comment (but not option comments) *after* the [section] tag instead of before it as it makes more sense that way (particularly for the [bind] section which has a new long comment to describe how it works). Disable profiling by default ============================ We had this weird state where we use and store profiling by default but never *load* it when starting up. This commit makes us just not use profiling at all unless explicitly enabled. Other misc changes: =================== - change default worker threads to 0 (= num cpus) instead of 1, and fix it to allow 0. - Actually apply worker-threads option - fixed default data-dir value erroneously having quotes around it - reordered ifname/ifaddr/mapaddr (was previously mapaddr/ifaddr/ifname) as mapaddr is a sort of specialization of ifaddr and so makes more sense to come after it (particularly because it now references ifaddr in its help message). - removed peer-stats option (since we always require it for relays and never use it for clients) - removed router profiles filename option (this doesn't need to be configurable) - removed defunct `service-node-seed` option - Change default logging output file to "" (which means stdout), and also made "-" work for stdout. * Router hive compilation fixes * Comments for SNApp SRV settings in ini file * Add extra blank line after section comments * Better deprecated option handling Allow {client,relay}-only options in {relay,client} configs to be specified as implicitly deprecated options: they warn, and don't set anything. Add an explicit `Deprecated` tag and move deprecated option handling into definition.cpp. * Move backwards compat options into section definitions Keep the "addBackwardsCompatibleConfigOptions" only for options in sections that no longer exist. * Fix INI parsing issues & C++17-ify - don't allow inline comments because it seems they aren't allowed in ini formats in general, and is going to cause problems if there is a comment character in a value (e.g. an exit auth string). Additionally it was breaking on a line such as: # some comment; see? because it was treating only `; see?` as the comment and then producing an error message about the rest of the line being invalid. - make section parsing stricter: the `[` and `]` have to be at the beginning at end of the line now (after stripping whitespace). - Move whitespace stripping to the top since everything in here does it. - chop off string_view suffix/prefix rather than maintaining position values - fix potential infinite loop/segfault when given a line such as `]foo[` * Make config parsing failure fatal Load() LogError's and returns false on failure, so we weren't aborting on config file errors. * Formatting: allow `{}` for empty functions/structs Instead of using two lines when empty: { } * Make default dns bind 127.0.0.1 on non-Linux * Don't show empty section; fix tests We can conceivably have sections that only make sense for clients or relays, and so want to completely omit that section if we have no options for the type of config being generated. Also fixes missing empty lines between tests. Co-authored-by: Thomas Winget <tewinget@gmail.com>stable
parent
62a90f4c82
commit
af6caf776a
|
@ -14,7 +14,23 @@ AlwaysBreakAfterDefinitionReturnType: All
|
|||
AlwaysBreakAfterReturnType: All
|
||||
AlwaysBreakTemplateDeclarations: 'true'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializersBeforeComma: 'true'
|
||||
Cpp11BracedListStyle: 'true'
|
||||
|
|
|
@ -259,7 +259,8 @@ run_main_context(const fs::path confFile, const llarp::RuntimeOptions opts)
|
|||
llarp::LogInfo("Using config file: ", confFile);
|
||||
|
||||
llarp::Config conf;
|
||||
conf.Load(confFile, opts.isRouter, confFile.parent_path());
|
||||
if (!conf.Load(confFile, opts.isRouter, confFile.parent_path()))
|
||||
throw std::runtime_error{"Config file parsing failed"};
|
||||
|
||||
ctx = std::make_shared<llarp::Context>();
|
||||
ctx->Configure(conf);
|
||||
|
|
|
@ -133,18 +133,15 @@ struct lokinet_jni_vpnio : public lokinet::VPNIO
|
|||
{
|
||||
void
|
||||
InjectSuccess() override
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
InjectFail() override
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
Tick() override
|
||||
{
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -63,7 +63,6 @@ namespace llarp
|
|||
std::string m_identityKeyFile;
|
||||
std::string m_transportKeyFile;
|
||||
|
||||
bool m_enablePeerStats = false;
|
||||
bool m_isRelay = false;
|
||||
|
||||
void
|
||||
|
@ -73,7 +72,6 @@ namespace llarp
|
|||
struct NetworkConfig
|
||||
{
|
||||
std::optional<bool> m_enableProfiling;
|
||||
std::string m_routerProfilesFile;
|
||||
std::string m_strictConnect;
|
||||
std::string m_ifname;
|
||||
IPRange m_ifaddr;
|
||||
|
@ -153,7 +151,6 @@ namespace llarp
|
|||
|
||||
struct LokidConfig
|
||||
{
|
||||
bool usingSNSeed = false;
|
||||
bool whitelistRouters = false;
|
||||
fs::path ident_keyfile;
|
||||
lokimq::address lokidRPCAddr;
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
#include <config/definition.hpp>
|
||||
#include <util/logging/logger.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <cassert>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
OptionDefinitionBase::OptionDefinitionBase(
|
||||
std::string section_, std::string name_, bool required_)
|
||||
: section(section_), name(name_), required(required_)
|
||||
{
|
||||
}
|
||||
OptionDefinitionBase::OptionDefinitionBase(
|
||||
std::string section_, std::string name_, bool required_, bool multiValued_)
|
||||
: section(section_), name(name_), required(required_), multiValued(multiValued_)
|
||||
{
|
||||
}
|
||||
|
||||
template <>
|
||||
bool
|
||||
OptionDefinition<bool>::fromString(const std::string& input)
|
||||
|
@ -32,17 +23,43 @@ namespace llarp
|
|||
ConfigDefinition&
|
||||
ConfigDefinition::defineOption(OptionDefinition_ptr def)
|
||||
{
|
||||
auto sectionItr = m_definitions.find(def->section);
|
||||
if (sectionItr == m_definitions.end())
|
||||
m_sectionOrdering.push_back(def->section);
|
||||
using namespace config;
|
||||
// If explicitly deprecated or is a {client,relay} option in a {relay,client} config then add a
|
||||
// dummy, warning option instead of this one.
|
||||
if (def->deprecated || (relay ? def->clientOnly : def->relayOnly))
|
||||
{
|
||||
return defineOption<std::string>(
|
||||
def->section,
|
||||
def->name,
|
||||
MultiValue,
|
||||
Hidden,
|
||||
[deprecated = def->deprecated,
|
||||
relay = relay,
|
||||
opt = "[" + def->section + "]:" + def->name](std::string_view) {
|
||||
LogWarn(
|
||||
"*** WARNING: The config option ",
|
||||
opt,
|
||||
(deprecated ? " is deprecated"
|
||||
: relay ? " is not valid in service node configuration files"
|
||||
: " is not valid in client configuration files"),
|
||||
" and has been ignored.");
|
||||
});
|
||||
}
|
||||
|
||||
auto& sectionDefinitions = m_definitions[def->section];
|
||||
if (sectionDefinitions.find(def->name) != sectionDefinitions.end())
|
||||
auto [sectionItr, newSect] = m_definitions.try_emplace(def->section);
|
||||
if (newSect)
|
||||
m_sectionOrdering.push_back(def->section);
|
||||
auto& section = sectionItr->first;
|
||||
|
||||
auto [it, added] = m_definitions[section].try_emplace(std::string{def->name}, std::move(def));
|
||||
if (!added)
|
||||
throw std::invalid_argument(
|
||||
stringify("definition for [", def->section, "]:", def->name, " already exists"));
|
||||
|
||||
m_definitionOrdering[def->section].push_back(def->name);
|
||||
sectionDefinitions[def->name] = std::move(def);
|
||||
m_definitionOrdering[section].push_back(it->first);
|
||||
|
||||
if (!it->second->comments.empty())
|
||||
addOptionComments(section, it->first, std::move(it->second->comments));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -153,10 +170,13 @@ namespace llarp
|
|||
const std::string& section, const std::string& name, std::vector<std::string> comments)
|
||||
{
|
||||
auto& defComments = m_definitionComments[section][name];
|
||||
for (size_t i = 0; i < comments.size(); ++i)
|
||||
{
|
||||
defComments.emplace_back(std::move(comments[i]));
|
||||
}
|
||||
if (defComments.empty())
|
||||
defComments = std::move(comments);
|
||||
else
|
||||
defComments.insert(
|
||||
defComments.end(),
|
||||
std::make_move_iterator(comments.begin()),
|
||||
std::make_move_iterator(comments.end()));
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -167,40 +187,48 @@ namespace llarp
|
|||
int sectionsVisited = 0;
|
||||
|
||||
visitSections([&](const std::string& section, const DefinitionMap&) {
|
||||
std::ostringstream sect_out;
|
||||
|
||||
visitDefinitions(section, [&](const std::string& name, const OptionDefinition_ptr& def) {
|
||||
bool has_comment = false;
|
||||
// TODO: as above, this will create empty objects
|
||||
// TODO: as above (but more important): this won't handle definitions with no entries
|
||||
// (i.e. those handled by UndeclaredValueHandler's)
|
||||
for (const std::string& comment : m_definitionComments[section][name])
|
||||
{
|
||||
sect_out << "\n# " << comment;
|
||||
has_comment = true;
|
||||
}
|
||||
|
||||
if (useValues and def->getNumberFound() > 0)
|
||||
{
|
||||
sect_out << "\n" << name << "=" << def->valueAsString(false) << "\n";
|
||||
}
|
||||
else if (not(def->hidden and not has_comment))
|
||||
{
|
||||
sect_out << "\n";
|
||||
if (not def->required)
|
||||
sect_out << "#";
|
||||
sect_out << name << "=" << def->defaultValueAsString() << "\n";
|
||||
}
|
||||
});
|
||||
|
||||
auto sect_str = sect_out.str();
|
||||
if (sect_str.empty())
|
||||
return; // Skip sections with no options
|
||||
|
||||
if (sectionsVisited > 0)
|
||||
oss << "\n\n";
|
||||
|
||||
oss << "[" << section << "]\n";
|
||||
|
||||
// TODO: this will create empty objects as a side effect of map's operator[]
|
||||
// TODO: this also won't handle sections which have no definition
|
||||
for (const std::string& comment : m_sectionComments[section])
|
||||
{
|
||||
oss << "# " << comment << "\n";
|
||||
}
|
||||
|
||||
oss << "[" << section << "]\n";
|
||||
|
||||
visitDefinitions(section, [&](const std::string& name, const OptionDefinition_ptr& def) {
|
||||
oss << "\n";
|
||||
|
||||
// TODO: as above, this will create empty objects
|
||||
// TODO: as above (but more important): this won't handle definitions with no entries
|
||||
// (i.e. those handled by UndeclaredValueHandler's)
|
||||
for (const std::string& comment : m_definitionComments[section][name])
|
||||
{
|
||||
oss << "# " << comment << "\n";
|
||||
}
|
||||
|
||||
if (useValues and def->getNumberFound() > 0)
|
||||
{
|
||||
oss << name << "=" << def->valueAsString(false) << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not def->required)
|
||||
oss << "#";
|
||||
oss << name << "=" << def->defaultValueAsString() << "\n";
|
||||
}
|
||||
});
|
||||
oss << "\n" << sect_str;
|
||||
|
||||
sectionsVisited++;
|
||||
});
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <util/str.hpp>
|
||||
#include <util/fs.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
@ -15,19 +18,111 @@
|
|||
|
||||
namespace llarp
|
||||
{
|
||||
namespace config
|
||||
{
|
||||
// Base class for the following option flag types
|
||||
struct option_flag
|
||||
{};
|
||||
|
||||
struct Required_t : option_flag
|
||||
{};
|
||||
struct Hidden_t : option_flag
|
||||
{};
|
||||
struct MultiValue_t : option_flag
|
||||
{};
|
||||
struct RelayOnly_t : option_flag
|
||||
{};
|
||||
struct ClientOnly_t : option_flag
|
||||
{};
|
||||
struct Deprecated_t : option_flag
|
||||
{};
|
||||
|
||||
/// Value to pass for an OptionDefinition to indicate that the option is required
|
||||
inline constexpr Required_t Required{};
|
||||
/// Value to pass for an OptionDefinition to indicate that the option should be hidden from the
|
||||
/// generate config file if it is unset (and has no comment). Typically for deprecated, renamed
|
||||
/// options that still do something, and for internal dev options that aren't usefully exposed.
|
||||
/// (For do-nothing deprecated options use Deprecated instead).
|
||||
inline constexpr Hidden_t Hidden{};
|
||||
/// Value to pass for an OptionDefinition to indicate that the option takes multiple values
|
||||
inline constexpr MultiValue_t MultiValue{};
|
||||
/// Value to pass for an option that should only be set for relay configs. If found in a client
|
||||
/// config it be ignored (but will produce a warning).
|
||||
inline constexpr RelayOnly_t RelayOnly{};
|
||||
/// Value to pass for an option that should only be set for client configs. If found in a relay
|
||||
/// config it will be ignored (but will produce a warning).
|
||||
inline constexpr ClientOnly_t ClientOnly{};
|
||||
/// Value to pass for an option that is deprecated and does nothing and should be ignored (with
|
||||
/// a deprecation warning) if specified. Note that Deprecated implies Hidden, and that
|
||||
/// {client,relay}-only options in a {relay,client} config are also considered Deprecated.
|
||||
inline constexpr Deprecated_t Deprecated{};
|
||||
|
||||
/// Wrapper to specify a default value to an OptionDefinition
|
||||
template <typename T>
|
||||
struct Default
|
||||
{
|
||||
T val;
|
||||
constexpr explicit Default(T val) : val{std::move(val)}
|
||||
{}
|
||||
};
|
||||
|
||||
/// Adds one or more comment lines to the option definition.
|
||||
struct Comment
|
||||
{
|
||||
std::vector<std::string> comments;
|
||||
explicit Comment(std::initializer_list<std::string> comments) : comments{std::move(comments)}
|
||||
{}
|
||||
};
|
||||
|
||||
/// A convenience function that returns an acceptor which assigns to a reference.
|
||||
///
|
||||
/// Note that this holds on to the reference; it must only be used when this is safe to do. In
|
||||
/// particular, a reference to a local variable may be problematic.
|
||||
template <typename T>
|
||||
auto
|
||||
AssignmentAcceptor(T& ref)
|
||||
{
|
||||
return [&ref](T arg) { ref = std::move(arg); };
|
||||
}
|
||||
|
||||
// C++20 backport:
|
||||
template <typename T>
|
||||
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_default = false;
|
||||
template <typename T>
|
||||
constexpr bool is_default<Default<T>> = true;
|
||||
template <typename U>
|
||||
constexpr bool is_default<U&> = is_default<remove_cvref_t<U>>;
|
||||
|
||||
template <typename T, typename Option>
|
||||
constexpr bool is_option =
|
||||
std::is_base_of_v<
|
||||
option_flag,
|
||||
remove_cvref_t<
|
||||
Option>> or std::is_same_v<Comment, Option> or is_default<Option> or std::is_invocable_v<remove_cvref_t<Option>, T>;
|
||||
} // namespace config
|
||||
|
||||
/// A base class for specifying config options and their constraints. The basic to/from string
|
||||
/// type functions are provided pure-virtual. The type-aware implementations which implement these
|
||||
/// functions are templated classes. One reason for providing a non-templated base class is so
|
||||
/// that they can all be mixed into the same containers (albiet as pointers).
|
||||
struct OptionDefinitionBase
|
||||
{
|
||||
OptionDefinitionBase(std::string section_, std::string name_, bool required_);
|
||||
OptionDefinitionBase(
|
||||
std::string section_, std::string name_, bool required_, bool multiValued_);
|
||||
template <typename... T>
|
||||
OptionDefinitionBase(std::string section_, std::string name_, const T&...)
|
||||
: section(std::move(section_))
|
||||
, name(std::move(name_))
|
||||
, required{(std::is_same_v<T, config::Required_t> || ...)}
|
||||
, multiValued{(std::is_same_v<T, config::MultiValue_t> || ...)}
|
||||
, deprecated{(std::is_same_v<T, config::Deprecated_t> || ...)}
|
||||
, hidden{deprecated || (std::is_same_v<T, config::Hidden_t> || ...)}
|
||||
, relayOnly{(std::is_same_v<T, config::RelayOnly_t> || ...)}
|
||||
, clientOnly{(std::is_same_v<T, config::ClientOnly_t> || ...)}
|
||||
{}
|
||||
|
||||
virtual ~OptionDefinitionBase()
|
||||
{
|
||||
}
|
||||
virtual ~OptionDefinitionBase() = default;
|
||||
|
||||
/// Subclasses should provide their default value as a string
|
||||
///
|
||||
|
@ -65,6 +160,13 @@ namespace llarp
|
|||
std::string name;
|
||||
bool required = false;
|
||||
bool multiValued = false;
|
||||
bool deprecated = false;
|
||||
bool hidden = false;
|
||||
bool relayOnly = false;
|
||||
bool clientOnly = false;
|
||||
// Temporarily holds comments given during construction until the option is actually added to
|
||||
// the owning ConfigDefinition.
|
||||
std::vector<std::string> comments;
|
||||
};
|
||||
|
||||
/// The primary type-aware implementation of OptionDefinitionBase, this templated class allows
|
||||
|
@ -84,33 +186,53 @@ namespace llarp
|
|||
/// 2) as the output in defaultValueAsString(), used to generate config files
|
||||
/// 3) as the output in valueAsString(), used to generate config files
|
||||
///
|
||||
/// @param acceptor_ is an optional function whose purpose is to both validate the parsed
|
||||
/// input and internalize it (e.g. copy it for runtime use). The acceptor should throw
|
||||
/// an exception with a useful message if it is not acceptable.
|
||||
OptionDefinition(
|
||||
std::string section_,
|
||||
std::string name_,
|
||||
bool required_,
|
||||
std::optional<T> defaultValue_,
|
||||
std::function<void(T)> acceptor_ = nullptr)
|
||||
: OptionDefinitionBase(section_, name_, required_)
|
||||
, defaultValue(defaultValue_)
|
||||
, acceptor(acceptor_)
|
||||
/// @param opts - 0 or more of config::Required, config::Hidden, config::Default{...}, etc.
|
||||
/// tagged options or an invocable acceptor validate and internalize input (e.g. copy it for
|
||||
/// runtime use). The acceptor should throw an exception with a useful message if it is not
|
||||
/// acceptable. Parameters may be passed in any order.
|
||||
template <
|
||||
typename... Options,
|
||||
std::enable_if_t<(config::is_option<T, Options> && ...), int> = 0>
|
||||
OptionDefinition(std::string section_, std::string name_, Options&&... opts)
|
||||
: OptionDefinitionBase(section_, name_, opts...)
|
||||
{
|
||||
(extractDefault(std::forward<Options>(opts)), ...);
|
||||
(extractAcceptor(std::forward<Options>(opts)), ...);
|
||||
(extractComments(std::forward<Options>(opts)), ...);
|
||||
}
|
||||
|
||||
/// As above, but also takes a bool value for multiValued.
|
||||
OptionDefinition(
|
||||
std::string section_,
|
||||
std::string name_,
|
||||
bool required_,
|
||||
bool multiValued_,
|
||||
std::optional<T> defaultValue_,
|
||||
std::function<void(T)> acceptor_ = nullptr)
|
||||
: OptionDefinitionBase(section_, name_, required_, multiValued_)
|
||||
, defaultValue(defaultValue_)
|
||||
, acceptor(acceptor_)
|
||||
/// Extracts a default value from an config::Default<U>; ignores anything that isn't an
|
||||
/// config::Default<U>.
|
||||
template <typename U>
|
||||
void
|
||||
extractDefault(U&& defaultValue_)
|
||||
{
|
||||
if constexpr (config::is_default<U>)
|
||||
{
|
||||
static_assert(
|
||||
std::is_convertible_v<decltype(std::forward<U>(defaultValue_).val), T>,
|
||||
"Cannot convert given llarp::config::Default to the required value type");
|
||||
defaultValue = std::forward<U>(defaultValue_).val;
|
||||
}
|
||||
}
|
||||
|
||||
/// Extracts an acceptor (i.e. something callable with a `T`) from options; ignores anything
|
||||
/// that isn't callable.
|
||||
template <typename U>
|
||||
void
|
||||
extractAcceptor(U&& acceptor_)
|
||||
{
|
||||
if constexpr (std::is_invocable_v<U, T>)
|
||||
acceptor = std::forward<U>(acceptor_);
|
||||
}
|
||||
|
||||
/// Extracts option Comments and forwards them addOptionComments.
|
||||
template <typename U>
|
||||
void
|
||||
extractComments(U&& comment)
|
||||
{
|
||||
if constexpr (std::is_same_v<config::remove_cvref_t<U>, config::Comment>)
|
||||
comments = std::forward<U>(comment).comments;
|
||||
}
|
||||
|
||||
/// Returns the first parsed value, if available. Otherwise, provides the default value if the
|
||||
|
@ -155,10 +277,14 @@ namespace llarp
|
|||
std::string
|
||||
defaultValueAsString() override
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (defaultValue)
|
||||
oss << *defaultValue;
|
||||
if (!defaultValue)
|
||||
return "";
|
||||
|
||||
if constexpr (std::is_same_v<fs::path, T>)
|
||||
return defaultValue->string();
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << *defaultValue;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
@ -224,7 +350,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
// don't use default value if we are multi-valued and have no value
|
||||
if (multiValued && parsedValues.size() == 0)
|
||||
if (multiValued and parsedValues.size() == 0)
|
||||
return;
|
||||
|
||||
if (acceptor)
|
||||
|
@ -289,11 +415,14 @@ namespace llarp
|
|||
/// calls to addConfigValue()).
|
||||
struct ConfigDefinition
|
||||
{
|
||||
/// Spefify the parameters and type of a configuration option. The parameters are members of
|
||||
explicit ConfigDefinition(bool relay) : relay{relay}
|
||||
{}
|
||||
|
||||
/// Specify the parameters and type of a configuration option. The parameters are members of
|
||||
/// OptionDefinitionBase; the type is inferred from OptionDefinition's template parameter T.
|
||||
///
|
||||
/// This function should be called for every option that this Configuration supports, and should
|
||||
/// be done before any other interractions involving that option.
|
||||
/// be done before any other interactions involving that option.
|
||||
///
|
||||
/// @param def should be a unique_ptr to a valid subclass of OptionDefinitionBase
|
||||
/// @return `*this` for chaining calls
|
||||
|
@ -307,7 +436,7 @@ namespace llarp
|
|||
ConfigDefinition&
|
||||
defineOption(Params&&... args)
|
||||
{
|
||||
return defineOption(std::make_unique<OptionDefinition<T>>(args...));
|
||||
return defineOption(std::make_unique<OptionDefinition<T>>(std::forward<Params>(args)...));
|
||||
}
|
||||
|
||||
/// Specify a config value for the given section and name. The value should be a valid string
|
||||
|
@ -416,6 +545,9 @@ namespace llarp
|
|||
generateINIConfig(bool useValues = false);
|
||||
|
||||
private:
|
||||
// If true skip client-only options; if false skip relay-only options.
|
||||
bool relay;
|
||||
|
||||
OptionDefinition_ptr&
|
||||
lookupDefinitionOrThrow(std::string_view section, std::string_view name);
|
||||
const OptionDefinition_ptr&
|
||||
|
@ -444,15 +576,4 @@ namespace llarp
|
|||
std::unordered_map<std::string, CommentsMap> m_definitionComments;
|
||||
};
|
||||
|
||||
/// A convenience acceptor which takes a reference and later assigns it in its acceptor call.
|
||||
///
|
||||
/// Note that this holds on to a reference; it must only be used when this is safe to do. In
|
||||
/// particular, a reference to a local variable may be problematic.
|
||||
template <typename T>
|
||||
std::function<void(T)>
|
||||
AssignmentAcceptor(T& ref)
|
||||
{
|
||||
return [&](T arg) mutable { ref = std::move(arg); };
|
||||
}
|
||||
|
||||
} // namespace llarp
|
||||
|
|
|
@ -72,62 +72,44 @@ namespace llarp
|
|||
|
||||
std::string_view sectName;
|
||||
size_t lineno = 0;
|
||||
for (const auto& line : lines)
|
||||
for (auto line : lines)
|
||||
{
|
||||
lineno++;
|
||||
std::string_view realLine;
|
||||
auto comment = line.find_first_of(';');
|
||||
if (comment == std::string_view::npos)
|
||||
comment = line.find_first_of('#');
|
||||
if (comment == std::string_view::npos)
|
||||
realLine = line;
|
||||
else
|
||||
realLine = line.substr(0, comment);
|
||||
// blank or commented line?
|
||||
if (realLine.size() == 0)
|
||||
// Trim whitespace
|
||||
while (!line.empty() && whitespace(line.front()))
|
||||
line.remove_prefix(1);
|
||||
while (!line.empty() && whitespace(line.back()))
|
||||
line.remove_suffix(1);
|
||||
|
||||
// Skip blank lines and comments
|
||||
if (line.empty() or line.front() == ';' or line.front() == '#')
|
||||
continue;
|
||||
// find delimiters
|
||||
auto sectOpenPos = realLine.find_first_of('[');
|
||||
auto sectClosPos = realLine.find_first_of(']');
|
||||
auto kvDelim = realLine.find_first_of('=');
|
||||
if (sectOpenPos != std::string_view::npos && sectClosPos != std::string_view::npos
|
||||
&& kvDelim == std::string_view::npos)
|
||||
|
||||
if (line.front() == '[' && line.back() == ']')
|
||||
{
|
||||
// section header
|
||||
|
||||
// clamp whitespaces
|
||||
++sectOpenPos;
|
||||
while (whitespace(realLine[sectOpenPos]) && sectOpenPos != sectClosPos)
|
||||
++sectOpenPos;
|
||||
--sectClosPos;
|
||||
while (whitespace(realLine[sectClosPos]) && sectClosPos != sectOpenPos)
|
||||
--sectClosPos;
|
||||
// set section name
|
||||
sectName = realLine.substr(sectOpenPos, sectClosPos);
|
||||
line.remove_prefix(1);
|
||||
line.remove_suffix(1);
|
||||
sectName = line;
|
||||
}
|
||||
else if (kvDelim != std::string_view::npos)
|
||||
else if (auto kvDelim = line.find('='); kvDelim != std::string_view::npos)
|
||||
{
|
||||
// key value pair
|
||||
std::string_view k = realLine.substr(0, kvDelim);
|
||||
std::string_view v = realLine.substr(kvDelim + 1);
|
||||
std::string_view k = line.substr(0, kvDelim);
|
||||
std::string_view v = line.substr(kvDelim + 1);
|
||||
// Trim inner whitespace
|
||||
while (!k.empty() && whitespace(k.back()))
|
||||
k.remove_suffix(1);
|
||||
while (!v.empty() && whitespace(v.front()))
|
||||
v.remove_prefix(1);
|
||||
|
||||
// clamp whitespaces
|
||||
for (auto* x : {&k, &v})
|
||||
{
|
||||
while (!x->empty() && whitespace(x->front()))
|
||||
x->remove_prefix(1);
|
||||
while (!x->empty() && whitespace(x->back()))
|
||||
x->remove_suffix(1);
|
||||
}
|
||||
|
||||
if (k.size() == 0)
|
||||
if (k.empty())
|
||||
{
|
||||
LogError(m_FileName, " invalid line (", lineno, "): '", line, "'");
|
||||
return false;
|
||||
}
|
||||
SectionValues_t& sect = m_Config[std::string{sectName}];
|
||||
LogDebug(m_FileName, ": ", sectName, ".", k, "=", v);
|
||||
sect.emplace(k, v);
|
||||
LogDebug(m_FileName, ": [", sectName, "]:", k, "=", v);
|
||||
m_Config[std::string{sectName}].emplace(k, v);
|
||||
}
|
||||
else // malformed?
|
||||
{
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
namespace llarp
|
||||
{
|
||||
KeyManager::KeyManager() : m_initialized(false), m_needBackup(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
KeyManager::initialize(const llarp::Config& config, bool genIfAbsent, bool isRouter)
|
||||
|
|
|
@ -167,8 +167,7 @@ namespace llarp
|
|||
|
||||
void
|
||||
Context::Reload()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
Context::SigINT()
|
||||
|
|
|
@ -56,8 +56,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
Encrypted(size_t sz) : Encrypted(nullptr, sz)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
BEncode(llarp_buffer_t* buf) const
|
||||
|
|
|
@ -16,14 +16,12 @@ namespace llarp
|
|||
struct EncryptedFrame : public Encrypted<EncryptedFrameSize>
|
||||
{
|
||||
EncryptedFrame() : EncryptedFrame(EncryptedFrameBodySize)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
EncryptedFrame(size_t sz)
|
||||
: Encrypted<EncryptedFrameSize>(
|
||||
std::min(sz, EncryptedFrameBodySize) + EncryptedFrameOverheadSize)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
Resize(size_t sz)
|
||||
|
@ -70,8 +68,7 @@ namespace llarp
|
|||
|
||||
AsyncFrameDecrypter(const SecretKey& secretkey, DecryptHandler h)
|
||||
: result(std::move(h)), seckey(secretkey)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
DecryptHandler result;
|
||||
const SecretKey& seckey;
|
||||
|
|
|
@ -20,16 +20,13 @@ namespace llarp
|
|||
PubKey() = default;
|
||||
|
||||
explicit PubKey(const byte_t* ptr) : AlignedBuffer<SIZE>(ptr)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit PubKey(const Data& data) : AlignedBuffer<SIZE>(data)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit PubKey(const AlignedBuffer<SIZE>& other) : AlignedBuffer<SIZE>(other)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
std::string
|
||||
ToString() const;
|
||||
|
@ -84,13 +81,11 @@ namespace llarp
|
|||
SecretKey() = default;
|
||||
|
||||
explicit SecretKey(const byte_t* ptr) : AlignedBuffer<SECKEYSIZE>(ptr)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// The full data
|
||||
explicit SecretKey(const AlignedBuffer<SECKEYSIZE>& seed) : AlignedBuffer<SECKEYSIZE>(seed)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// Just the seed, we recalculate the pubkey
|
||||
explicit SecretKey(const AlignedBuffer<32>& seed)
|
||||
|
@ -147,12 +142,10 @@ namespace llarp
|
|||
PrivateKey() = default;
|
||||
|
||||
explicit PrivateKey(const byte_t* ptr) : AlignedBuffer<64>(ptr)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit PrivateKey(const AlignedBuffer<64>& key_and_hash) : AlignedBuffer<64>(key_and_hash)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Returns a pointer to the beginning of the 32-byte hash which is used for
|
||||
/// pseudorandomness when signing with this private key.
|
||||
|
@ -195,8 +188,7 @@ namespace llarp
|
|||
struct IdentitySecret final : public AlignedBuffer<32>
|
||||
{
|
||||
IdentitySecret() : AlignedBuffer<32>()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// no copy constructor
|
||||
explicit IdentitySecret(const IdentitySecret&) = delete;
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace llarp
|
|||
using Random_t = std::function<uint64_t()>;
|
||||
|
||||
Bucket(const Key_t& us, Random_t r) : nodes(XorMetric(us)), random(std::move(r))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
util::StatusObject
|
||||
ExtractStatus() const
|
||||
|
|
|
@ -12,8 +12,7 @@ namespace llarp
|
|||
{
|
||||
ExploreNetworkJob(const RouterID& peer, AbstractContext* ctx)
|
||||
: TX<RouterID, RouterID>(TXOwner{}, peer, ctx)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
Validate(const RouterID&) const override
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace llarp
|
|||
const Key_t us;
|
||||
|
||||
XorMetric(const Key_t& ourKey) : us(ourKey)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
operator()(const Key_t& left, const Key_t& right) const
|
||||
|
|
|
@ -13,20 +13,16 @@ namespace llarp
|
|||
struct Key_t : public AlignedBuffer<32>
|
||||
{
|
||||
explicit Key_t(const byte_t* buf) : AlignedBuffer<SIZE>(buf)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit Key_t(const Data& data) : AlignedBuffer<SIZE>(data)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit Key_t(const AlignedBuffer<SIZE>& data) : AlignedBuffer<SIZE>(data)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Key_t() : AlignedBuffer<SIZE>()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// get snode address string
|
||||
std::string
|
||||
|
|
|
@ -16,8 +16,7 @@ namespace llarp
|
|||
const PathID_t& path, uint64_t txid, const RouterID& _target, AbstractContext* ctx)
|
||||
: RecursiveRouterLookup(TXOwner{ctx->OurKey(), txid}, _target, ctx, nullptr)
|
||||
, localPath(path)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
LocalRouterLookup::SendReply()
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace llarp
|
|||
__attribute__((unused)) const Key_t& askpeer)
|
||||
: ServiceAddressLookup(TXOwner{ctx->OurKey(), txid}, addr, ctx, relayOrder, nullptr)
|
||||
, localPath(pathid)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
LocalServiceAddressLookup::SendReply()
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace llarp
|
|||
LocalTagLookup::LocalTagLookup(
|
||||
const PathID_t& path, uint64_t txid, const service::Tag& _target, AbstractContext* ctx)
|
||||
: TagLookup(TXOwner{ctx->OurKey(), txid}, _target, ctx, 0), localPath(path)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
LocalTagLookup::SendReply()
|
||||
|
|
|
@ -22,8 +22,7 @@ namespace llarp
|
|||
bool relayed = false;
|
||||
|
||||
MessageDecoder(const Key_t& from, bool wasRelayed) : From(from), relayed(wasRelayed)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
operator()(llarp_buffer_t* buffer, llarp_buffer_t* key)
|
||||
|
@ -105,8 +104,7 @@ namespace llarp
|
|||
{
|
||||
ListDecoder(bool hasRelayed, const Key_t& from, std::vector<IMessage::Ptr_t>& list)
|
||||
: relayed(hasRelayed), From(from), l(list)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool relayed;
|
||||
const Key_t& From;
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace llarp
|
|||
|
||||
/// construct
|
||||
IMessage(const Key_t& from) : From(from)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
using Ptr_t = std::unique_ptr<IMessage>;
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ namespace llarp
|
|||
|
||||
FindIntroMessage(const llarp::service::Tag& tag, uint64_t txid)
|
||||
: IMessage({}), tagName(tag), txID(txid)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit FindIntroMessage(uint64_t txid, const Key_t& addr, uint64_t order)
|
||||
: IMessage({}), location(addr), txID(txid), relayOrder(order)
|
||||
|
|
|
@ -11,8 +11,7 @@ namespace llarp::dht
|
|||
{
|
||||
FindNameMessage::FindNameMessage(const Key_t& from, Key_t namehash, uint64_t txid)
|
||||
: IMessage(from), NameHash(std::move(namehash)), TxID(txid)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
FindNameMessage::BEncode(llarp_buffer_t* buf) const
|
||||
|
|
|
@ -10,14 +10,12 @@ namespace llarp
|
|||
{
|
||||
// inbound parsing
|
||||
FindRouterMessage(const Key_t& from) : IMessage(from)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// find by routerid
|
||||
FindRouterMessage(uint64_t id, const RouterID& target)
|
||||
: IMessage({}), targetKey(target), txid(id)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// exploritory
|
||||
FindRouterMessage(uint64_t id) : IMessage({}), exploritory(true), txid(id)
|
||||
|
@ -48,8 +46,7 @@ namespace llarp
|
|||
struct RelayedFindRouterMessage final : public FindRouterMessage
|
||||
{
|
||||
RelayedFindRouterMessage(const Key_t& from) : FindRouterMessage(from)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// handle a relayed FindRouterMessage, do a lookup on the dht and inform
|
||||
/// the path of the result
|
||||
|
|
|
@ -15,8 +15,7 @@ namespace llarp
|
|||
{
|
||||
GotIntroMessage::GotIntroMessage(std::vector<service::EncryptedIntroSet> results, uint64_t tx)
|
||||
: IMessage({}), found(std::move(results)), txid(tx)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
GotIntroMessage::HandleMessage(
|
||||
|
|
|
@ -23,8 +23,7 @@ namespace llarp
|
|||
std::optional<Key_t> closer;
|
||||
|
||||
GotIntroMessage(const Key_t& from) : IMessage(from)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
GotIntroMessage(const GotIntroMessage& other)
|
||||
: IMessage(other.From), found(other.found), txid(other.txid), closer(other.closer)
|
||||
|
@ -35,8 +34,7 @@ namespace llarp
|
|||
/// for iterative reply
|
||||
GotIntroMessage(const Key_t& from, const Key_t& _closer, uint64_t _txid)
|
||||
: IMessage(from), txid(_txid), closer(_closer)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// for recursive reply
|
||||
GotIntroMessage(std::vector<service::EncryptedIntroSet> results, uint64_t txid);
|
||||
|
@ -56,8 +54,7 @@ namespace llarp
|
|||
struct RelayedGotIntroMessage final : public GotIntroMessage
|
||||
{
|
||||
RelayedGotIntroMessage() : GotIntroMessage({})
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
HandleMessage(llarp_dht_context* ctx, std::vector<IMessage::Ptr_t>& replies) const override;
|
||||
|
|
|
@ -14,23 +14,19 @@ namespace llarp
|
|||
struct GotRouterMessage final : public IMessage
|
||||
{
|
||||
GotRouterMessage(const Key_t& from, bool tunneled) : IMessage(from), relayed(tunneled)
|
||||
{
|
||||
}
|
||||
{}
|
||||
GotRouterMessage(
|
||||
const Key_t& from, uint64_t id, const std::vector<RouterContact>& results, bool tunneled)
|
||||
: IMessage(from), foundRCs(results), txid(id), relayed(tunneled)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
GotRouterMessage(const Key_t& from, const Key_t& closer, uint64_t id, bool tunneled)
|
||||
: IMessage(from), closerTarget(new Key_t(closer)), txid(id), relayed(tunneled)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
GotRouterMessage(uint64_t id, std::vector<RouterID> _near, bool tunneled)
|
||||
: IMessage({}), nearKeys(std::move(_near)), txid(id), relayed(tunneled)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// gossip message
|
||||
GotRouterMessage(const RouterContact rc) : IMessage({}), foundRCs({rc}), txid(0)
|
||||
|
|
|
@ -18,8 +18,7 @@ namespace llarp
|
|||
uint64_t relayOrder = 0;
|
||||
uint64_t txID = 0;
|
||||
PublishIntroMessage(const Key_t& from, bool relayed_) : IMessage(from), relayed(relayed_)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
PublishIntroMessage(
|
||||
const llarp::service::EncryptedIntroSet& introset_,
|
||||
|
@ -27,8 +26,7 @@ namespace llarp
|
|||
bool relayed_,
|
||||
uint64_t relayOrder_)
|
||||
: IMessage({}), introset(introset_), relayed(relayed_), relayOrder(relayOrder_), txID(tx)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
~PublishIntroMessage() override;
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
RCNode(const RouterContact& other) : rc(other), ID(other.pubkey)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
util::StatusObject
|
||||
ExtractStatus() const
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace llarp
|
|||
: TX<TXOwner, service::EncryptedIntroSet>(asker, asker, ctx)
|
||||
, relayOrder(relayOrder_)
|
||||
, introset(introset_)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
PublishServiceJob::Validate(const service::EncryptedIntroSet& value) const
|
||||
|
@ -56,8 +55,7 @@ namespace llarp
|
|||
AbstractContext* ctx,
|
||||
uint64_t relayOrder)
|
||||
: PublishServiceJob(peer, introset, ctx, relayOrder), localPath(fromID), txid(_txid)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
LocalPublishServiceJob::SendReply()
|
||||
|
|
|
@ -15,8 +15,7 @@ namespace llarp
|
|||
TagLookup(
|
||||
const TXOwner& asker, const service::Tag& tag, AbstractContext* ctx, uint64_t recursion)
|
||||
: TX<service::Tag, service::EncryptedIntroSet>(asker, tag, ctx), recursionDepth(recursion)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
Validate(const service::EncryptedIntroSet& introset) const override;
|
||||
|
|
|
@ -26,8 +26,7 @@ namespace llarp
|
|||
|
||||
TX(const TXOwner& asker, const K& k, AbstractContext* p)
|
||||
: target(k), parent(p), whoasked(asker)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
virtual ~TX() = default;
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ namespace llarp
|
|||
operator=(const TXOwner&) = default;
|
||||
|
||||
TXOwner(const Key_t& k, uint64_t id) : node(k), txid(id)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
util::StatusObject
|
||||
ExtractStatus() const
|
||||
|
|
|
@ -55,8 +55,7 @@ namespace llarp
|
|||
, answers(std::move(other.answers))
|
||||
, authorities(std::move(other.authorities))
|
||||
, additional(std::move(other.additional))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Message::Message(const Message& other)
|
||||
: hdr_id(other.hdr_id)
|
||||
|
@ -65,8 +64,7 @@ namespace llarp
|
|||
, answers(other.answers)
|
||||
, authorities(other.authorities)
|
||||
, additional(other.additional)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Message::Message(const MessageHeader& hdr) : hdr_id(hdr.id), hdr_fields(hdr.fields)
|
||||
{
|
||||
|
|
|
@ -12,12 +12,10 @@ namespace llarp
|
|||
: qname(std::move(other.qname))
|
||||
, qtype(std::move(other.qtype))
|
||||
, qclass(std::move(other.qclass))
|
||||
{
|
||||
}
|
||||
{}
|
||||
Question::Question(const Question& other)
|
||||
: qname(other.qname), qtype(other.qtype), qclass(other.qclass)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
Question::Encode(llarp_buffer_t* buf) const
|
||||
|
|
|
@ -14,8 +14,7 @@ namespace llarp
|
|||
, rr_class(other.rr_class)
|
||||
, ttl(other.ttl)
|
||||
, rData(other.rData)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
ResourceRecord::ResourceRecord(ResourceRecord&& other)
|
||||
: rr_name(std::move(other.rr_name))
|
||||
|
@ -23,8 +22,7 @@ namespace llarp
|
|||
, rr_class(std::move(other.rr_class))
|
||||
, ttl(std::move(other.ttl))
|
||||
, rData(std::move(other.rData))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
ResourceRecord::Encode(llarp_buffer_t* buf) const
|
||||
|
|
|
@ -31,8 +31,7 @@ namespace llarp
|
|||
|
||||
void
|
||||
Proxy::Stop()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
Proxy::Start(const IpAddress& addr, const std::vector<IpAddress>& resolvers)
|
||||
|
@ -137,8 +136,7 @@ namespace llarp
|
|||
|
||||
void
|
||||
Proxy::HandleTick(llarp_udp_io*)
|
||||