mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
make netid configurable on runtime
bump version to 0.4.0 subscribe to pewdiepie
This commit is contained in:
parent
7350120a8a
commit
0fd36d3b79
|
@ -391,6 +391,8 @@ struct llarp_epoll_loop : public llarp_ev_loop
|
|||
llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].data.ptr);
|
||||
if(ev)
|
||||
{
|
||||
llarp::LogDebug(idx, " of ", result,
|
||||
" events=", std::to_string(events[idx].events));
|
||||
if(events[idx].events & EPOLLERR)
|
||||
{
|
||||
ev->error();
|
||||
|
|
|
@ -1430,6 +1430,20 @@ namespace llarp
|
|||
}
|
||||
else if(StrEq(section, "router"))
|
||||
{
|
||||
if(StrEq(key, "netid"))
|
||||
{
|
||||
if(strlen(val) <= self->_rc.netID.size())
|
||||
{
|
||||
llarp::LogWarn("!!!! you have manually set netid to be '", val,
|
||||
"' which does not equal '", LLARP_NET_ID,
|
||||
"' you will run as a different network, good luck and "
|
||||
"don't forget: something something MUH traffic shape "
|
||||
"correlation !!!!");
|
||||
llarp::NetID::DefaultValue = (const byte_t *)strdup(val);
|
||||
}
|
||||
else
|
||||
llarp::LogError("invalid netid '", val, "', is too long");
|
||||
}
|
||||
if(StrEq(key, "nickname"))
|
||||
{
|
||||
self->_rc.SetNick(val);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace llarp
|
||||
{
|
||||
const byte_t *NetID::DefaultValue = (const byte_t *)LLARP_NET_ID;
|
||||
|
||||
bool RouterContact::IgnoreBogons = false;
|
||||
|
||||
#ifdef TESTNET
|
||||
|
@ -21,7 +23,7 @@ namespace llarp
|
|||
/// 1 day for real network
|
||||
llarp_time_t RouterContact::Lifetime = 24 * 60 * 60 * 1000;
|
||||
#endif
|
||||
NetID::NetID() : AlignedBuffer< 8 >((const byte_t *)LLARP_NET_ID)
|
||||
NetID::NetID() : AlignedBuffer< 8 >(DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -74,9 +76,8 @@ namespace llarp
|
|||
/* write netid */
|
||||
if(!bencode_write_bytestring(buf, "i", 1))
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buf, netID.data(), netID.size()))
|
||||
if(!netID.BEncode(buf))
|
||||
return false;
|
||||
|
||||
/* write signing pubkey */
|
||||
if(!bencode_write_bytestring(buf, "k", 1))
|
||||
return false;
|
||||
|
@ -238,7 +239,7 @@ namespace llarp
|
|||
bool
|
||||
RouterContact::Verify(llarp::Crypto *crypto, llarp_time_t now) const
|
||||
{
|
||||
if(netID.ToString() != LLARP_NET_ID)
|
||||
if(netID != NetID())
|
||||
return false;
|
||||
if(IsExpired(now))
|
||||
return false;
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace llarp
|
|||
/// NetID
|
||||
struct NetID final : public AlignedBuffer< 8 >
|
||||
{
|
||||
static const byte_t *DefaultValue;
|
||||
|
||||
NetID();
|
||||
|
||||
bool
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
#endif
|
||||
|
||||
#ifndef LLARP_VERSION_MIN
|
||||
#define LLARP_VERSION_MIN "3"
|
||||
#define LLARP_VERSION_MIN "4"
|
||||
#endif
|
||||
|
||||
#ifndef LLARP_VERSION_PATCH
|
||||
#define LLARP_VERSION_PATCH "1"
|
||||
#define LLARP_VERSION_PATCH "0"
|
||||
#endif
|
||||
|
||||
#ifndef LLARP_VERSION_NUM
|
||||
|
|
|
@ -61,7 +61,7 @@ struct UTPTest : public ::testing::Test
|
|||
|| (__APPLE__ && __MACH__)
|
||||
return "lo0";
|
||||
#else
|
||||
return "lo"
|
||||
return "lo";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue