Merge pull request #1694 from oxen-io/dev

0.9.5
pull/1766/head v0.9.5
Jeff 3 years ago committed by GitHub
commit 44ad8ad3dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,7 +16,7 @@ if(CCACHE_PROGRAM)
endif()
project(lokinet
VERSION 0.9.4
VERSION 0.9.5
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES C CXX)
@ -141,7 +141,7 @@ if(LIBUV_FOUND AND NOT BUILD_STATIC_DEPS)
target_link_libraries(libuv INTERFACE PkgConfig::LIBUV)
else()
if(NOT BUILD_STATIC_DEPS)
message(FATAL_ERROR "Could not find libu >= 1.28.0; install it on your system or use -DBUILD_STATIC_DEPS=ON")
message(FATAL_ERROR "Could not find libuv >= 1.28.0; install it on your system or use -DBUILD_STATIC_DEPS=ON")
endif()
endif()
@ -302,6 +302,19 @@ endif()
add_subdirectory(external)
include_directories(SYSTEM external/sqlite_orm/include)
option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON)
if(USE_JEMALLOC AND NOT STATIC_LINK)
pkg_check_modules(JEMALLOC jemalloc IMPORTED_TARGET)
if(JEMALLOC_FOUND)
target_link_libraries(base_libs INTERFACE PkgConfig::JEMALLOC)
else()
message(STATUS "jemalloc not found, not linking to jemalloc")
endif()
else()
message(STATUS "jemalloc support disabled")
endif()
if(ANDROID)
target_link_libraries(base_libs INTERFACE log)
target_compile_definitions(base_libs INTERFACE ANDROID)

@ -0,0 +1,3 @@
FROM node:14.16.1
RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections'
RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata gdb cmake git ninja-build pkg-config ccache g++ wine'

@ -8,6 +8,6 @@ test "x$registry" != "x" || exit 1
for file in ${@:2} ; do
name="$(echo $file | cut -d'.' -f1)"
echo "rebuild $name"
docker build -f $file -t $registry/lokinet-ci-$name --pull --no-cache --quiet .
docker build -f $file -t $registry/lokinet-ci-$name .
docker push $registry/lokinet-ci-$name
done

@ -6,6 +6,7 @@ import sys
import time
import platform
import os
import re
from argparse import ArgumentParser as AP
is_windows = lambda : platform.system().lower() == 'windows'
@ -40,12 +41,13 @@ except ImportError:
print("for other linuxs do:")
print("\tpip3 install --user geoip")
print("for other linuxs you are responsible for obtaining your owen geoip databases, glhf")
time.sleep(1)
else:
print("install it with:")
print("\tpip3 install --user geoip")
print("")
print("press enter to continue without geoip")
sys.stdin.read(1)
print()
print("press enter to continue without geoip")
sys.stdin.read(1)
else:
try:
geoip_env_var = 'GEOIP_DB_FILE'
@ -86,6 +88,7 @@ def ip_to_flag(ip):
class Monitor:
_sample_size = 12
filter = lambda x : True
def __init__(self, url, introsetMode=False):
self.txrate = 0
@ -144,7 +147,7 @@ class Monitor:
self.win.addstr(" {} ->".format(hopstr))
self.win.addstr(" [{} ms latency]".format(path["intro"]["latency"]))
self.win.addstr(" [{} until expire]".format(self.time_to(path["expiresAt"])))
self.win.addstr(" [expires: {}]".format(self.time_to(path["expiresAt"])))
if path["expiresSoon"]:
self.win.addstr("(expiring)")
elif path["expired"]:
@ -153,13 +156,17 @@ class Monitor:
@staticmethod
def time_to(timestamp):
""" return time until timestamp in seconds formatted"""
""" return time until timestamp formatted"""
if timestamp:
unit = 'seconds'
val = (timestamp - now()) / 1000.0
if abs(val) > 60.0:
val /= 60.0
unit = 'minutes'
if val < 0:
return "{} seconds ago".format(0-val)
return "{:.2f} {} ago".format(0-val, unit)
else:
return "{} seconds".format(val)
return "in {:.2f} {}".format(val, unit)
else:
return 'never'
@ -201,15 +208,18 @@ class Monitor:
paths = status["paths"]
self.win.addstr("paths: {}".format(len(paths)))
for path in paths:
y_pos = self._render_path(y_pos, path, "inbound")
if self.filter('localhost.loki'):
y_pos = self._render_path(y_pos, path, "localhost.loki")
for session in (status["remoteSessions"] or []):
for path in session["paths"]:
y_pos = self._render_path(
y_pos, path, "[active] {}".format(session["currentConvoTag"])
)
if self.filter(session["remoteIdentity"]):
y_pos = self._render_path(
y_pos, path, "[active] {}".format(session["currentConvoTag"])
)
for session in (status["snodeSessions"] or []):
for path in session["paths"]:
y_pos = self._render_path(y_pos, path, "[snode]")
if self.filter(session["endpoint"]):
y_pos = self._render_path(y_pos, path, "[snode]")
return y_pos
def display_links(self, y_pos, data):
@ -407,18 +417,20 @@ class Monitor:
"""
y_pos += 1
self.win.move(y_pos, 1)
self.win.addstr("localhost.loki")
y_pos = self._display_our_introset(y_pos, service)
y_pos += 1
if self.filter("localhost.loki"):
self.win.addstr("localhost.loki")
y_pos = self._display_our_introset(y_pos, service)
y_pos += 1
remotes = service['remoteSessions'] or []
for session in remotes:
y_pos = self._display_session_introset(y_pos, session)
if self.filter(session['remoteIdentity']):
y_pos = self._display_session_introset(y_pos, session)
def _display_intro(self, y_pos, intro, label, paths):
y_pos += 1
self.win.move(y_pos, 1)
path = 'path' in intro and intro['path'][:4] or '????'
self.win.addstr('{}: ({}|{}) [expires in: {}] [{} paths]'.format(label, intro['router'][:8], path, self.time_to(intro['expiresAt']), self.count_endpoints_in_path(paths, intro['router'])))
self.win.addstr('{}: ({}|{}) [expires: {}] [{} paths]'.format(label, intro['router'][:8], path, self.time_to(intro['expiresAt']), self.count_endpoints_in_path(paths, intro['router'])))
return y_pos
@staticmethod
@ -457,10 +469,13 @@ class Monitor:
#print(context.keys())
y_pos += 1
self.win.move(y_pos, 1)
readyState = context['readyToSend'] and '' or '❌'
readyState = context['readyToSend'] and '' or '❌'
self.win.addstr('{} ({}) [{}]'.format(context['remoteIdentity'], context['currentConvoTag'], readyState))
y_pos += 1
self.win.move(y_pos, 1)
self.win.addstr('created: {}'.format(self.time_to(context['sessionCreatedAt'])))
y_pos += 1
self.win.move(y_pos, 1)
self.win.addstr('last good send: {}'.format(self.time_to(context['lastGoodSend'])))
y_pos += 1
self.win.move(y_pos, 1)
@ -544,6 +559,8 @@ def main():
ap.add_argument("--introset", action='store_const', const=True, default=False, help="run in introset inspection mode")
ap.add_argument("--url", default='tcp://127.0.0.1:1190', type=str, help='url to lokinet rpc')
ap.add_argument('--filter', default='.+', type=str, help="regex to filter entries")
ap.add_argument('--invert-filter', const=True, default=False, action='store_const', help='invert regex filter matching')
args = ap.parse_args()
@ -551,6 +568,10 @@ def main():
args.url,
args.introset
)
mon.filter = lambda x : re.match(args.filter, x) is not None
if args.invert_filter:
old_filter = mon.filter
mon.filter = lambda x : not old_filter(x)
mon.run()
if __name__ == "__main__":

@ -4,7 +4,7 @@ if (NOT DOXYGEN)
return()
endif()
find_program(SPHINX_BUILD sphinx-build)
if (NOT DOXYGEN)
if (NOT SPHINX_BUILD)
message(STATUS "Documentation generation disabled (sphinx-build not found)")
return()
endif()
@ -22,7 +22,7 @@ add_custom_command(
add_custom_command(
OUTPUT html/index.html
COMMAND ${SPHINX_BUILD}
COMMAND ${SPHINX_BUILD} -j auto
-Dbreathe_projects.lokinet=${CMAKE_CURRENT_BINARY_DIR}/doxyxml
-Dversion=${lokinet_VERSION} -Drelease=${lokinet_VERSION}
-Aversion=${lokinet_VERSION} -Aversions=${lokinet_VERSION_MAJOR},${lokinet_VERSION_MINOR},${lokinet_VERSION_PATCH}

@ -46,6 +46,7 @@ namespace llarp
obj["lastExitUse"] = to_json(m_LastUse);
auto pub = m_ExitIdentity.toPublic();
obj["exitIdentity"] = pub.ToString();
obj["endpoint"] = m_ExitRouter.ToString();
return obj;
}

@ -24,7 +24,7 @@ namespace llarp::iwp
keyManager, getrc, h, sign, before, est, reneg, timeout, closed, pumpDone, worker)
, m_Wakeup{ev->make_waker([this]() { HandleWakeupPlaintext(); })}
, m_PlaintextRecv{1024}
, permitInbound{allowInbound}
, m_Inbound{allowInbound}
{}
@ -34,6 +34,15 @@ namespace llarp::iwp
return "iwp";
}
std::string
LinkLayer::PrintableName() const
{
if (m_Inbound)
return "inbound iwp link";
else
return "outbound iwp link";
}
uint16_t
LinkLayer::Rank() const
{
@ -48,10 +57,10 @@ namespace llarp::iwp
bool isNewSession = false;
if (itr == m_AuthedAddrs.end())
{
Lock_t lock(m_PendingMutex);
Lock_t lock{m_PendingMutex};
if (m_Pending.count(from) == 0)
{
if (not permitInbound)
if (not m_Inbound)
return;
isNewSession = true;
m_Pending.insert({from, std::make_shared<Session>(this, from)});
@ -60,14 +69,13 @@ namespace llarp::iwp
}
else
{
Lock_t lock(m_AuthedLinksMutex);
auto range = m_AuthedLinks.equal_range(itr->second);
session = range.first->second;
if (auto s_itr = m_AuthedLinks.find(itr->second); s_itr != m_AuthedLinks.end())
session = s_itr->second;
}
if (session)
{
bool success = session->Recv_LL(std::move(pkt));
if (!success and isNewSession)
if (not success and isNewSession)
{
LogWarn("Brand new session failed; removing from pending sessions list");
m_Pending.erase(m_Pending.find(from));
@ -78,7 +86,7 @@ namespace llarp::iwp
bool
LinkLayer::MapAddr(const RouterID& r, ILinkSession* s)
{
if (!ILinkLayer::MapAddr(r, s))
if (not ILinkLayer::MapAddr(r, s))
return false;
m_AuthedAddrs.emplace(s->GetRemoteEndpoint(), r);
return true;
@ -93,6 +101,8 @@ namespace llarp::iwp
std::shared_ptr<ILinkSession>
LinkLayer::NewOutboundSession(const RouterContact& rc, const AddressInfo& ai)
{
if (m_Inbound)
throw std::logic_error{"inbound link cannot make outbound sessions"};
return std::make_shared<Session>(this, rc, ai);
}

@ -56,6 +56,9 @@ namespace llarp::iwp
void
AddWakeup(std::weak_ptr<Session> peer);
std::string
PrintableName() const;
private:
void
HandleWakeupPlaintext();
@ -63,7 +66,7 @@ namespace llarp::iwp
const std::shared_ptr<EventLoopWakeup> m_Wakeup;
std::unordered_map<SockAddr, std::weak_ptr<Session>> m_PlaintextRecv;
std::unordered_map<SockAddr, RouterID> m_AuthedAddrs;
const bool permitInbound;
const bool m_Inbound;
};
using LinkLayer_ptr = std::shared_ptr<LinkLayer>;

@ -91,6 +91,7 @@ namespace llarp
LogError("ident key mismatch");
return false;
}
m_RemoteRC = msg->rc;
GotLIM = util::memFn(&Session::GotRenegLIM, this);
auto self = shared_from_this();
@ -171,7 +172,7 @@ namespace llarp
m_Parent->UnmapAddr(m_RemoteAddr);
m_State = State::Closed;
EncryptAndSend(std::move(close_msg));
LogInfo("closing connection to ", m_RemoteAddr);
LogInfo(m_Parent->PrintableName(), " closing connection to ", m_RemoteAddr);
}
bool
@ -330,7 +331,9 @@ namespace llarp
if (m_State == State::Ready || m_State == State::LinkIntro)
{
return now > m_LastRX
&& now - m_LastRX > (m_Inbound ? DefaultLinkSessionLifetime : SessionAliveTimeout);
&& now - m_LastRX
> (m_Inbound and not m_RemoteRC.IsPublicRouter() ? DefaultLinkSessionLifetime
: SessionAliveTimeout);
}
return now - m_CreatedAt >= LinkLayerConnectTimeout;
}
@ -448,13 +451,15 @@ namespace llarp
{
if (not DecryptMessageInPlace(pkt))
{
LogError("failed to decrypt session request from ", m_RemoteAddr);
LogError(
m_Parent->PrintableName(), " failed to decrypt session request from ", m_RemoteAddr);
return;
}
if (pkt.size() < token.size() + PacketOverhead)
{
LogError(
"bad session request size, ",
m_Parent->PrintableName(),
" bad session request size, ",
pkt.size(),
" < ",
token.size() + PacketOverhead,
@ -465,7 +470,7 @@ namespace llarp
const auto begin = pkt.data() + PacketOverhead;
if (not std::equal(begin, begin + token.size(), token.data()))
{
LogError("token mismatch from ", m_RemoteAddr);
LogError(m_Parent->PrintableName(), " token mismatch from ", m_RemoteAddr);
return;
}
m_LastRX = m_Parent->Now();
@ -478,7 +483,7 @@ namespace llarp
{
if (pkt.size() < (Introduction::SIZE + PacketOverhead))
{
LogWarn("intro too small from ", m_RemoteAddr);
LogWarn(m_Parent->PrintableName(), " intro too small from ", m_RemoteAddr);
return;
}
byte_t* ptr = pkt.data() + PacketOverhead;
@ -495,7 +500,7 @@ namespace llarp
pkt.data() + PacketOverhead, Introduction::SIZE - Signature::SIZE);
if (!CryptoManager::instance()->verify(m_ExpectedIdent, verifybuf, Z))
{
LogError("intro verify failed from ", m_RemoteAddr);
LogError(m_Parent->PrintableName(), " intro verify failed from ", m_RemoteAddr);
return;
}
const PubKey pk = m_Parent->TransportSecretKey().toPublic();
@ -529,7 +534,8 @@ namespace llarp
if (pkt.size() < (token.size() + PacketOverhead))
{
LogError(
"bad intro ack size ",
m_Parent->PrintableName(),
" bad intro ack size ",
pkt.size(),
" < ",
token.size() + PacketOverhead,
@ -540,7 +546,7 @@ namespace llarp
Packet_t reply(token.size() + PacketOverhead);
if (not DecryptMessageInPlace(pkt))
{
LogError("intro ack decrypt failed from ", m_RemoteAddr);
LogError(m_Parent->PrintableName(), " intro ack decrypt failed from ", m_RemoteAddr);
return;
}
m_LastRX = m_Parent->Now();
@ -575,7 +581,8 @@ namespace llarp
if (H != expected)
{
LogError(
"keyed hash mismatch ",
m_Parent->PrintableName(),
" keyed hash mismatch ",
H,
" != ",
expected,

@ -12,8 +12,6 @@ static constexpr auto LINK_LAYER_TICK_INTERVAL = 100ms;
namespace llarp
{
static constexpr size_t MaxSessionsPerKey = 16;
ILinkLayer::ILinkLayer(
std::shared_ptr<KeyManager> keyManager,
GetRCFunc getrc,
@ -241,7 +239,7 @@ namespace llarp
auto itr = m_Pending.find(addr);
if (itr != m_Pending.end())
{
if (m_AuthedLinks.count(pk) > MaxSessionsPerKey)
if (m_AuthedLinks.count(pk))
{
LogWarn("too many session for ", pk);
s->Close();
@ -303,21 +301,24 @@ namespace llarp
{
{
Lock_t l(m_AuthedLinksMutex);
if (m_AuthedLinks.count(rc.pubkey) >= MaxSessionsPerKey)
if (m_AuthedLinks.count(rc.pubkey))
{
LogDebug("Too many links to ", RouterID{rc.pubkey}, ", not establishing another one");
LogWarn("Too many links to ", RouterID{rc.pubkey}, ", not establishing another one");
return false;
}
}
llarp::AddressInfo to;
if (!PickAddress(rc, to))
if (not PickAddress(rc, to))
{
LogWarn("router ", RouterID{rc.pubkey}, " has no acceptable inbound addresses");
return false;
}
const SockAddr address{to};
{
Lock_t l(m_PendingMutex);
if (m_Pending.count(address) >= MaxSessionsPerKey)
if (m_Pending.count(address))
{
LogDebug(
LogWarn(
"Too many pending connections to ",
address,
" while establishing to ",
@ -331,12 +332,12 @@ namespace llarp
{
BeforeConnect(std::move(rc));
}
if (PutSession(s))
if (not PutSession(s))
{
s->Start();
return true;
return false;
}
return false;
s->Start();
return true;
}
bool

@ -17,9 +17,31 @@ namespace llarp
Timeout,
RouterNotFound,
InvalidRouter,
NoLink
NoLink,
EstablishFail
};
inline std::ostream&
operator<<(std::ostream& out, const SessionResult& st)
{
switch (st)
{
case SessionResult::Establish:
return out << "success";
case SessionResult::Timeout:
return out << "timeout";
case SessionResult::NoLink:
return out << "no link";
case SessionResult::InvalidRouter:
return out << "invalid router";
case SessionResult::RouterNotFound:
return out << "not found";
case SessionResult::EstablishFail:
return out << "establish failed";
}
return out << "???";
}
using RouterCallback = std::function<void(const RouterID&, const SessionResult)>;
struct IOutboundSessionMaker

@ -137,61 +137,31 @@ namespace llarp
outboundMessageQueues.emplace(zeroID, MessageQueue());
}
void
OutboundMessageHandler::OnSessionEstablished(const RouterID& router)
{
FinalizeSessionRequest(router, SendStatus::Success);
}
void
OutboundMessageHandler::OnConnectTimeout(const RouterID& router)
{
FinalizeSessionRequest(router, SendStatus::Timeout);
}
void
OutboundMessageHandler::OnRouterNotFound(const RouterID& router)
{
FinalizeSessionRequest(router, SendStatus::RouterNotFound);
}
void
OutboundMessageHandler::OnInvalidRouter(const RouterID& router)
{
FinalizeSessionRequest(router, SendStatus::InvalidRouter);
}
void
OutboundMessageHandler::OnNoLink(const RouterID& router)
{
FinalizeSessionRequest(router, SendStatus::NoLink);
}
void
OutboundMessageHandler::OnSessionResult(const RouterID& router, const SessionResult result)
static inline SendStatus
ToSendStatus(const SessionResult result)
{
switch (result)
{
case SessionResult::Establish:
OnSessionEstablished(router);
break;
return SendStatus::Success;
case SessionResult::Timeout:
OnConnectTimeout(router);
break;
case SessionResult::EstablishFail:
return SendStatus::Timeout;
case SessionResult::RouterNotFound:
OnRouterNotFound(router);
break;
return SendStatus::RouterNotFound;
case SessionResult::InvalidRouter:
OnInvalidRouter(router);
break;
return SendStatus::InvalidRouter;
case SessionResult::NoLink:
OnNoLink(router);
break;
default:
LogError("Impossible situation: enum class value out of bounds.");
std::abort();
break;
return SendStatus::NoLink;
}
throw std::invalid_argument{
stringify("SessionResult ", result, " has no corrispoding SendStatus when transforming")};
}
void
OutboundMessageHandler::OnSessionResult(const RouterID& router, const SessionResult result)
{
FinalizeSessionRequest(router, ToSendStatus(result));
}
void

@ -114,22 +114,6 @@ namespace llarp
* the messages are dropped and their send status callbacks are invoked with
* the appropriate send status.
*/
void
OnSessionEstablished(const RouterID& router);
void
OnConnectTimeout(const RouterID& router);
void
OnRouterNotFound(const RouterID& router);
void
OnInvalidRouter(const RouterID& router);
void
OnNoLink(const RouterID& router);
void
OnSessionResult(const RouterID& router, const SessionResult result);

@ -35,10 +35,10 @@ namespace llarp
OutboundSessionMaker::OnSessionEstablished(ILinkSession* session)
{
// TODO: do we want to keep it
const RouterContact rc = session->GetRemoteRC();
const auto router = RouterID(session->GetPubKey());
const bool isOutbound = not session->IsInbound();
const std::string remoteType = session->GetRemoteRC().IsPublicRouter() ? "router" : "client";
const std::string remoteType = rc.IsPublicRouter() ? "router" : "client";
LogInfo(
"session with ", remoteType, " [", router, "] ", isOutbound ? "established" : "received");
@ -48,9 +48,12 @@ namespace llarp
return false;
}
work([this, rc = session->GetRemoteRC()] { VerifyRC(rc); });
return true;
if (isOutbound)
{
work([this, rc] { VerifyRC(rc); });
return true;
}
return _rcLookup->CheckRC(rc);
}
void
@ -80,6 +83,14 @@ namespace llarp
CreatePendingSession(router);
// short-circuit to success callback if we already have an outbound session
// to the remote
if (_linkManager->HasOutboundSessionTo(router))
{
FinalizeRequest(router, SessionResult::Establish);
return;
}
LogDebug("Creating session establish attempt to ", router, " .");
auto fn = util::memFn(&OutboundSessionMaker::OnRouterContactResult, this);
@ -90,21 +101,31 @@ namespace llarp
void
OutboundSessionMaker::CreateSessionTo(const RouterContact& rc, RouterCallback on_result)
{
const RouterID router{rc.pubkey};
if (on_result)
{
util::Lock l(_mutex);
auto itr_pair = pendingCallbacks.emplace(rc.pubkey, CallbacksQueue{});
auto itr_pair = pendingCallbacks.emplace(router, CallbacksQueue{});
itr_pair.first->second.push_back(on_result);
}
if (not HavePendingSessionTo(rc.pubkey))
if (not HavePendingSessionTo(router))
{
LogDebug("Creating session establish attempt to ", rc.pubkey, " .");
CreatePendingSession(rc.pubkey);
LogDebug("Creating session establish attempt to ", router);
CreatePendingSession(router);
}
GotRouterContact(rc.pubkey, rc);
// short-circuit to success callback if we already have an outbound session
// to the remote
if (_linkManager->HasOutboundSessionTo(router))
{
FinalizeRequest(router, SessionResult::Establish);
return;
}
GotRouterContact(router, rc);
}
bool
@ -186,12 +207,10 @@ namespace llarp
}
const auto& job = itr->second;
if (!job->link->TryEstablishTo(job->rc))
if (not job->link->TryEstablishTo(job->rc))
{
// TODO: maybe different failure type?
l.unlock();
FinalizeRequest(router, SessionResult::NoLink);
FinalizeRequest(router, SessionResult::EstablishFail);
}
}
@ -211,7 +230,7 @@ namespace llarp
LinkLayer_ptr link = _linkManager->GetCompatibleLink(rc);
if (!link)
if (not link)
{
l.unlock();
FinalizeRequest(router, SessionResult::NoLink);
@ -226,10 +245,6 @@ namespace llarp
{
_loop->call([this, router] { DoEstablish(router); });
}
else if (_linkManager->HasSessionTo(router))
{
FinalizeRequest(router, SessionResult::Establish);
}
else
{
FinalizeRequest(router, SessionResult::NoLink);
@ -241,16 +256,18 @@ namespace llarp
{
if (router == us or not _rcLookup->SessionIsAllowed(router))
return false;
if (_linkManager->HasOutboundSessionTo(router))
return false;
if (_router->IsServiceNode())
return true;
size_t numPending = 0;
{
util::Lock lock(_mutex);
if (pendingSessions.find(router) == pendingSessions.end())
numPending += pendingSessions.size();
}
if (_linkManager->HasOutboundSessionTo(router))
return false;
if (_router->IsServiceNode())
return true;
return _linkManager->NumberOfConnectedRouters() + numPending < maxConnectedRouters;
}

@ -83,10 +83,6 @@ namespace llarp
{
if (_running)
{
util::StatusObject peerStatsObj = nullptr;
if (m_peerDb)
peerStatsObj = m_peerDb->ExtractStatus();
return util::StatusObject{
{"running", true},
{"numNodesKnown", _nodedb->NumLoaded()},
@ -94,8 +90,7 @@ namespace llarp
{"services", _hiddenServiceContext.ExtractStatus()},
{"exit", _exitContext.ExtractStatus()},
{"links", _linkManager.ExtractStatus()},
{"outboundMessages", _outboundMessageHandler.ExtractStatus()},
{"peerStats", peerStatsObj}};
{"outboundMessages", _outboundMessageHandler.ExtractStatus()}};
}
else
{
@ -679,14 +674,6 @@ namespace llarp
hiddenServiceContext().AddEndpoint(conf);
}
// peer stats
if (IsServiceNode())
{
LogInfo("Initializing peerdb...");
m_peerDb = std::make_shared<PeerDb>();
m_peerDb->configure(conf.router);
}
// Logging config
LogContext::Instance().Initialize(
conf.logging.m_logLevel,
@ -1233,7 +1220,8 @@ namespace llarp
router,
" (",
previous_fails + 1,
" consecutive failures)");
" consecutive failures) result=",
result);
}
else
{

@ -404,6 +404,10 @@ namespace llarp
m_ReadyHooks.clear();
}
if (m_LastInboundTraffic > 0s and lastGoodSend > 0s
and now >= sendTimeout + m_LastInboundTraffic)
return true;
const auto timeout = std::max(lastGoodSend, m_LastInboundTraffic);
if (lastGoodSend > 0s and now >= timeout + (sendTimeout / 2))
{

@ -12,7 +12,7 @@ You can view documentation on how to get started [here](https://docs.oxen.io/pro
A simple demo application that is lokinet "aware" can be found [here](https://github.com/majestrate/lokinet-aware-demos)
[![Build Status](https://ci.oxen.rocks/api/badges/oxen-io/loki-network/status.svg?ref=refs/heads/dev)](https://ci.oxen.rocks/oxen-io/loki-network)
[![Build Status](https://ci.oxen.rocks/api/badges/oxen-io/lokinet/status.svg?ref=refs/heads/dev)](https://ci.oxen.rocks/oxen-io/lokinet)
## Building
@ -43,8 +43,8 @@ You can install these using:
If you are not on a platform supported by the debian packages or if you want to build a dev build, this is the most "portable" way to do it:
$ sudo apt install build-essential cmake git libcap-dev pkg-config automake libtool
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -60,8 +60,8 @@ You can get the latest stable macos relase from https://lokinet.org/ or check th
alternatively you can build from source, make sure you have cmake, libuv and xcode command line tools installed:
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -88,8 +88,8 @@ setup:
building:
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ ./contrib/windows.sh
### Solaris 2.10+
@ -105,8 +105,8 @@ build:
$ sudo pkg install build-essential gcc8 wget tuntap cmake (optional: ninja ccache - from omnios extra) (OmniOS CE)
$ sudo pkg install base-developer-utilities developer-gnu developer-studio-utilities gcc-7 wget cmake (Oracle Solaris, see note)
$ sudo pkg install build-essential wget gcc-8 documentation/tuntap header-tun tun (optional: ninja ccache) (all other SunOS)
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake ..
@ -121,8 +121,8 @@ install:
build:
$ pkg install cmake git pkgconf
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON -DBUILD_SHARED_DEPS=ON ..

@ -8,10 +8,10 @@ Puede aprender a grandes razgos sobre el diseño de LLARP [aquí](docs/high-leve
Y puede leer las especificaciones del protocolo [aquí](docs/proto_v0.txt) , documento técnico en idioma ingles.
Puede ver la documentación, en ingles, de como empezar [aqui](https://loki-project.github.io/loki-docs/Lokinet/LokinetOverview/) .
Puede ver la documentación, en ingles, de como empezar [aqui](https://oxen-io.github.io/loki-docs/Lokinet/LokinetOverview/) .
[![Build Status](https://ci.oxen.rocks/api/badges/oxen-io/lokinet/status.svg?ref=refs/heads/dev)](https://ci.oxen.rocks/oxen-io/lokinet)
![build status](https://gitlab.com/lokiproject/loki-network/badges/master/pipeline.svg "build status")
![travis-ci](https://travis-ci.org/loki-project/loki-network.svg?branch=master "ci status")
## Uso
@ -80,8 +80,8 @@ Requerimientos de compilación:
compilando:
$ sudo apt install build-essential cmake git libcap-dev curl libuv1-dev libsodium-dev pkg-config
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -103,8 +103,8 @@ esto coloca el paquete compilado en `../`
compilando:
este seguro que usted tiene cmake, libuv y las herramientas de terminal de xcode ya instaladas
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -119,8 +119,8 @@ instalando:
compilar (donde `$ARCH` es su plataforma - `i686` or `x86_64`):
$ pacman -Sy base-devel mingw-w64-$ARCH-toolchain git libtool autoconf mingw-w64-$ARCH-cmake
$ git clone https://github.com/loki-project/loki-network.git
$ cd loki-network
$ git clone https://github.com/oxen-io/lokinet.git
$ cd lokinet
$ mkdir -p build; cd build
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK_RUNTIME=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G 'Unix Makefiles'
@ -149,8 +149,8 @@ compilando:
$ sudo pkg install build-essential gcc8 wget tuntap cmake (opcional: ninja ccache - de los extra de omnios) (OmniOS CE)
$ sudo pkg install base-developer-utilities developer-gnu developer-studio-utilities gcc-7 wget cmake (Solaris de Oracle, ver notas)
$ sudo pkg install build-essential wget gcc-8 documentation/tuntap header-tun tun (opcional: ninja ccache) (todos los demas SunOS)
$ git clone https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone https://github.com/oxen-io/lokinet
$ cd lokinet
$ gmake -j8
instalando:
@ -167,8 +167,8 @@ PENDIENTE: agregar instrucciones para pkgsrc
compilando:
# pkg_add curl cmake git (opcional: ninja ccache)
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -183,8 +183,8 @@ instalando (root):
compilando:
$ pkg install cmake git curl libuv-1.27.0 libsodium
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON

@ -8,9 +8,9 @@ Lokinet - реализация LLARP (протокол анонимной мар
Почитать спецификацию протокола LLARP [здесь](docs/proto_v0.txt)
Почитать документацию о том, как начать работу [здесь](https://loki-project.github.io/loki-docs/Lokinet/LokinetOverview/)
Почитать документацию о том, как начать работу [здесь](https://oxen-io.github.io/loki-docs/Lokinet/LokinetOverview/)
[![Build Status](https://drone.lokinet.dev/api/badges/loki-project/loki-network/status.svg?ref=refs/heads/master)](https://drone.lokinet.dev/loki-project/loki-network)
[![Build Status](https://drone.lokinet.dev/api/badges/oxen-io/lokinet/status.svg?ref=refs/heads/master)](https://drone.lokinet.dev/oxen-io/lokinet)
## Использование
@ -71,8 +71,8 @@ Lokinet - реализация LLARP (протокол анонимной мар
сборка:
$ sudo apt install build-essential cmake git libcap-dev curl libuv1-dev libsodium-dev pkg-config
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -87,8 +87,8 @@ Lokinet - реализация LLARP (протокол анонимной мар
сборка:
убедитесь, что у вас установлены инструменты командной строки cmake, libuv и xcode
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
@ -113,8 +113,8 @@ Lokinet - реализация LLARP (протокол анонимной мар
сборка:
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build-windows
$ cd build-windows
$ cmake -DBUILD_STATIC_DEPS=ON -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -DCMAKE_TOOLCHAIN_FILE='../contrib/cross/mingw64.cmake' -DWITH_TESTS=OFF -DCMAKE_CROSSCOMPILING=ON ..
@ -133,8 +133,8 @@ Lokinet - реализация LLARP (протокол анонимной мар
$ sudo pkg install build-essential gcc8 wget tuntap cmake (optional: ninja ccache - from omnios extra) (OmniOS CE)
$ sudo pkg install base-developer-utilities developer-gnu developer-studio-utilities gcc-7 wget cmake (Oracle Solaris, see note)
$ sudo pkg install build-essential wget gcc-8 documentation/tuntap header-tun tun (optional: ninja ccache) (all other SunOS)
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cd build
$ cmake ..
@ -149,8 +149,8 @@ Lokinet - реализация LLARP (протокол анонимной мар
сборка:
$ pkg install cmake git curl libuv libsodium pkgconf libunbound
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ git clone --recursive https://github.com/oxen-io/lokinet
$ cd lokinet
$ mkdir build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make

Loading…
Cancel
Save