1
1
Fork 0
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:
Jeff Becker 2018-12-21 08:08:01 -05:00
parent 7350120a8a
commit 0fd36d3b79
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05
7 changed files with 27 additions and 8 deletions

View file

@ -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); llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].data.ptr);
if(ev) if(ev)
{ {
llarp::LogDebug(idx, " of ", result,
" events=", std::to_string(events[idx].events));
if(events[idx].events & EPOLLERR) if(events[idx].events & EPOLLERR)
{ {
ev->error(); ev->error();

View file

@ -1430,6 +1430,20 @@ namespace llarp
} }
else if(StrEq(section, "router")) 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")) if(StrEq(key, "nickname"))
{ {
self->_rc.SetNick(val); self->_rc.SetNick(val);

View file

@ -12,6 +12,8 @@
namespace llarp namespace llarp
{ {
const byte_t *NetID::DefaultValue = (const byte_t *)LLARP_NET_ID;
bool RouterContact::IgnoreBogons = false; bool RouterContact::IgnoreBogons = false;
#ifdef TESTNET #ifdef TESTNET
@ -21,7 +23,7 @@ namespace llarp
/// 1 day for real network /// 1 day for real network
llarp_time_t RouterContact::Lifetime = 24 * 60 * 60 * 1000; llarp_time_t RouterContact::Lifetime = 24 * 60 * 60 * 1000;
#endif #endif
NetID::NetID() : AlignedBuffer< 8 >((const byte_t *)LLARP_NET_ID) NetID::NetID() : AlignedBuffer< 8 >(DefaultValue)
{ {
} }
@ -74,9 +76,8 @@ namespace llarp
/* write netid */ /* write netid */
if(!bencode_write_bytestring(buf, "i", 1)) if(!bencode_write_bytestring(buf, "i", 1))
return false; return false;
if(!bencode_write_bytestring(buf, netID.data(), netID.size())) if(!netID.BEncode(buf))
return false; return false;
/* write signing pubkey */ /* write signing pubkey */
if(!bencode_write_bytestring(buf, "k", 1)) if(!bencode_write_bytestring(buf, "k", 1))
return false; return false;
@ -238,7 +239,7 @@ namespace llarp
bool bool
RouterContact::Verify(llarp::Crypto *crypto, llarp_time_t now) const RouterContact::Verify(llarp::Crypto *crypto, llarp_time_t now) const
{ {
if(netID.ToString() != LLARP_NET_ID) if(netID != NetID())
return false; return false;
if(IsExpired(now)) if(IsExpired(now))
return false; return false;

View file

@ -17,6 +17,8 @@ namespace llarp
/// NetID /// NetID
struct NetID final : public AlignedBuffer< 8 > struct NetID final : public AlignedBuffer< 8 >
{ {
static const byte_t *DefaultValue;
NetID(); NetID();
bool bool

View file

@ -6,11 +6,11 @@
#endif #endif
#ifndef LLARP_VERSION_MIN #ifndef LLARP_VERSION_MIN
#define LLARP_VERSION_MIN "3" #define LLARP_VERSION_MIN "4"
#endif #endif
#ifndef LLARP_VERSION_PATCH #ifndef LLARP_VERSION_PATCH
#define LLARP_VERSION_PATCH "1" #define LLARP_VERSION_PATCH "0"
#endif #endif
#ifndef LLARP_VERSION_NUM #ifndef LLARP_VERSION_NUM

View file

@ -1 +1 @@
kuz yolo subscribe to pewdiepie

View file

@ -61,7 +61,7 @@ struct UTPTest : public ::testing::Test
|| (__APPLE__ && __MACH__) || (__APPLE__ && __MACH__)
return "lo0"; return "lo0";
#else #else
return "lo" return "lo";
#endif #endif
} }