mirror of https://github.com/oxen-io/lokinet
clarify strict-connect usage and enforce minimum of 2 nodes
This commit is contained in:
parent
cc2bbc20ca
commit
3b6953badc
|
@ -300,9 +300,9 @@ namespace llarp
|
||||||
throw std::invalid_argument{"duplicate strict connect snode: " + value};
|
throw std::invalid_argument{"duplicate strict connect snode: " + value};
|
||||||
},
|
},
|
||||||
Comment{
|
Comment{
|
||||||
"Public key of a router which will act as a pinned first-hop. This may be used to",
|
"Public keys of routers which will act as pinned first-hops. This may be used to",
|
||||||
"provide a trusted router (consider that you are not fully anonymous with your",
|
"provide a trusted router (consider that you are not fully anonymous with your",
|
||||||
"first hop).",
|
"first hop). This REQUIRES two or more nodes to be specified.",
|
||||||
});
|
});
|
||||||
|
|
||||||
conf.defineOption<std::string>(
|
conf.defineOption<std::string>(
|
||||||
|
|
|
@ -653,14 +653,15 @@ namespace llarp
|
||||||
auto& networkConfig = conf.network;
|
auto& networkConfig = conf.network;
|
||||||
|
|
||||||
/// build a set of strictConnectPubkeys (
|
/// build a set of strictConnectPubkeys (
|
||||||
/// TODO: make this consistent with config -- do we support multiple strict connections
|
|
||||||
// or not?
|
|
||||||
std::unordered_set<RouterID> strictConnectPubkeys;
|
std::unordered_set<RouterID> strictConnectPubkeys;
|
||||||
if (not networkConfig.m_strictConnect.empty())
|
if (not networkConfig.m_strictConnect.empty())
|
||||||
{
|
{
|
||||||
const auto& val = networkConfig.m_strictConnect;
|
const auto& val = networkConfig.m_strictConnect;
|
||||||
if (IsServiceNode())
|
if (IsServiceNode())
|
||||||
throw std::runtime_error("cannot use strict-connect option as service node");
|
throw std::runtime_error("cannot use strict-connect option as service node");
|
||||||
|
if (val.size() < 2)
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Must specify more than one strict-connect router if using strict-connect");
|
||||||
strictConnectPubkeys.insert(val.begin(), val.end());
|
strictConnectPubkeys.insert(val.begin(), val.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue