Rename SnappConfig -> EndpointConfig

pull/1246/head
Stephen Shelton 4 years ago committed by Jeff Becker
parent 93b35c92a7
commit df01770466
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -367,7 +367,7 @@ namespace llarp
}
void
SnappConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params)
EndpointConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params)
{
(void)params;
@ -378,7 +378,7 @@ namespace llarp
static constexpr int MinLatencyDefault = 5000;
if (m_name.empty())
throw std::runtime_error("Cannot create SnappConfig with empty name");
throw std::runtime_error("Cannot create EndpointConfig with empty name");
const std::string section = m_name + "-snapp";
@ -502,7 +502,7 @@ namespace llarp
if (ending == suffix)
{
SnappConfig snappConf;
EndpointConfig snappConf;
snappConf.m_name = str(snappName);
snappConf.defineConfigOptions(conf, params);

@ -153,7 +153,7 @@ namespace llarp
defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params);
};
struct SnappConfig
struct EndpointConfig
{
std::string m_name;
std::string m_keyfile;
@ -192,7 +192,7 @@ namespace llarp
LokidConfig lokid;
BootstrapConfig bootstrap;
LoggingConfig logging;
std::unordered_map<std::string, SnappConfig> snapps;
std::unordered_map<std::string, EndpointConfig> snapps;
// Initialize config definition
void

@ -10,7 +10,7 @@ namespace llarp
struct NullEndpoint final : public llarp::service::Endpoint,
public std::enable_shared_from_this<NullEndpoint>
{
NullEndpoint(const SnappConfig& conf, AbstractRouter* r, llarp::service::Context* parent)
NullEndpoint(const EndpointConfig& conf, AbstractRouter* r, llarp::service::Context* parent)
: llarp::service::Endpoint(conf, r, parent)
{
}

@ -50,7 +50,7 @@ namespace llarp
}
TunEndpoint::TunEndpoint(
const SnappConfig& conf, AbstractRouter* r, service::Context* parent, bool lazyVPN)
const EndpointConfig& conf, AbstractRouter* r, service::Context* parent, bool lazyVPN)
: service::Endpoint(conf, r, parent)
, m_UserToNetworkPktQueue(conf.m_name + "_sendq", r->netloop(), r->netloop())
, m_NetworkToUserPktQueue(conf.m_name + "_recvq", r->netloop(), r->netloop())
@ -105,7 +105,7 @@ namespace llarp
}
bool
TunEndpoint::Configure(SnappConfig conf)
TunEndpoint::Configure(EndpointConfig conf)
{
/*
if (k == "reachable")

@ -21,7 +21,7 @@ namespace llarp
public std::enable_shared_from_this<TunEndpoint>
{
TunEndpoint(
const SnappConfig& conf,
const EndpointConfig& conf,
AbstractRouter* r,
llarp::service::Context* parent,
bool lazyVPN = false);
@ -34,7 +34,7 @@ namespace llarp
}
bool
Configure(SnappConfig conf) override;
Configure(EndpointConfig conf) override;
void
Tick(llarp_time_t now) override;

@ -589,8 +589,8 @@ namespace llarp
// TODO: this was previously incorporating the "sane defaults" for netConfig
// netConfig should be refactored to use strongly typed member variables
// instead of an ad-hoc multimap
const SnappConfig& snappConfig = pairs.second;
hiddenServiceContext().AddEndpoint(snappConfig);
const EndpointConfig& endpointConfig = pairs.second;
hiddenServiceContext().AddEndpoint(endpointConfig);
}
// Logging config

@ -14,23 +14,23 @@ namespace llarp
namespace
{
using EndpointConstructor = std::function<service::Endpoint_ptr(
const SnappConfig&, AbstractRouter*, service::Context*)>;
const EndpointConfig&, AbstractRouter*, service::Context*)>;
using EndpointConstructors = std::map<std::string, EndpointConstructor>;
static EndpointConstructors endpointConstructors = {
{"tun",
[](const SnappConfig& conf, AbstractRouter* r, service::Context* c) {
[](const EndpointConfig& conf, AbstractRouter* r, service::Context* c) {
return std::make_shared<handlers::TunEndpoint>(conf, r, c, false);
}},
{"android",
[](const SnappConfig& conf, AbstractRouter* r, service::Context* c) {
[](const EndpointConfig& conf, AbstractRouter* r, service::Context* c) {
return std::make_shared<handlers::TunEndpoint>(conf, r, c, true);
}},
{"ios",
[](const SnappConfig& conf, AbstractRouter* r, service::Context* c) {
[](const EndpointConfig& conf, AbstractRouter* r, service::Context* c) {
return std::make_shared<handlers::TunEndpoint>(conf, r, c, true);
}},
{"null", [](const SnappConfig& conf, AbstractRouter* r, service::Context* c) {
{"null", [](const EndpointConfig& conf, AbstractRouter* r, service::Context* c) {
return std::make_shared<handlers::NullEndpoint>(conf, r, c);
}}};
@ -198,7 +198,7 @@ namespace llarp
}
void
Context::AddEndpoint(const SnappConfig& conf, bool autostart)
Context::AddEndpoint(const EndpointConfig& conf, bool autostart)
{
if (m_Endpoints.find(conf.m_name) != m_Endpoints.end())
throw std::invalid_argument(stringify("Snapp ", conf.m_name, " already exists"));

@ -41,7 +41,7 @@ namespace llarp
/// add endpoint via config
void
AddEndpoint(const SnappConfig& conf, bool autostart = false);
AddEndpoint(const EndpointConfig& conf, bool autostart = false);
/// inject endpoint instance
void

@ -33,7 +33,7 @@ namespace llarp
{
namespace service
{
Endpoint::Endpoint(const SnappConfig& conf, AbstractRouter* r, Context* parent)
Endpoint::Endpoint(const EndpointConfig& conf, AbstractRouter* r, Context* parent)
: path::Builder(r, 3, path::default_len), context(parent), m_RecvQueue(128)
{
m_state = std::make_unique<EndpointState>();
@ -44,7 +44,7 @@ namespace llarp
}
bool
Endpoint::Configure(SnappConfig conf)
Endpoint::Configure(EndpointConfig conf)
{
numPaths = conf.m_paths;
numHops = conf.m_hops;

@ -69,7 +69,7 @@ namespace llarp
{
static const size_t MAX_OUTBOUND_CONTEXT_COUNT = 4;
Endpoint(const SnappConfig& conf, AbstractRouter* r, Context* parent);
Endpoint(const EndpointConfig& conf, AbstractRouter* r, Context* parent);
~Endpoint() override;
/// return true if we are ready to recv packets from the void
@ -94,7 +94,7 @@ namespace llarp
SetHandler(IDataHandler* h);
virtual bool
Configure(SnappConfig conf);
Configure(EndpointConfig conf);
void
Tick(llarp_time_t now) override;

@ -11,7 +11,7 @@ namespace llarp
namespace service
{
bool
EndpointState::Configure(SnappConfig conf)
EndpointState::Configure(EndpointConfig conf)
{
m_Keyfile = std::move(conf.m_keyfile);
m_Tag = std::move(conf.m_tag);
@ -20,7 +20,7 @@ namespace llarp
m_MinPathLatency = conf.m_minLatency;
m_BundleRC = conf.m_bundleRC;
// TODO: update SnappConfig to treat these as RouterIDs and detect dupes
// TODO: update EndpointConfig to treat these as RouterIDs and detect dupes
for (const auto& item : conf.m_snodeBlacklist)
{
RouterID snode;

@ -98,7 +98,7 @@ namespace llarp
util::DecayingHashSet<Address> m_RemoteLookupFilter;
bool
Configure(SnappConfig conf);
Configure(EndpointConfig conf);
util::StatusObject
ExtractStatus(util::StatusObject& obj) const;

Loading…
Cancel
Save