clang-tidy modernize pass

pull/693/head
Michael 5 years ago
parent d4eef2747a
commit 16cdfbd5f0
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -1,2 +1,2 @@
HeaderFilterRegex: 'llarp/.*' HeaderFilterRegex: 'llarp/.*'
Checks: 'readability-else-after-return,clang-analyzer-core-*' Checks: 'readability-else-after-return,clang-analyzer-core-*,modernize-*'

@ -8,6 +8,10 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if (MSVC OR MSVC_VERSION) if (MSVC OR MSVC_VERSION)
add_compile_options(/EHca /arch:AVX2 /MD) add_compile_options(/EHca /arch:AVX2 /MD)
add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
add_compile_options(-Wno-nonportable-system-include-path)
endif()
endif() endif()
if(NOT MSVC_VERSION) if(NOT MSVC_VERSION)

@ -27,10 +27,8 @@ namespace llarp
{ {
return ptr; return ptr;
} }
else
{ return val;
return val;
}
} }
template <> template <>
@ -43,10 +41,8 @@ namespace llarp
{ {
return std::atoi(ptr); return std::atoi(ptr);
} }
else
{ return val;
return val;
}
} }
template <> template <>
@ -59,10 +55,8 @@ namespace llarp
{ {
return std::atoi(ptr); return std::atoi(ptr);
} }
else
{ return val;
return val;
}
} }
template <> template <>
@ -75,10 +69,8 @@ namespace llarp
{ {
return std::atoll(ptr); return std::atoll(ptr);
} }
else
{ return val;
return val;
}
} }
template <> template <>
@ -92,10 +84,8 @@ namespace llarp
{ {
return IsTrueValue(ptr); return IsTrueValue(ptr);
} }
else
{ return val;
return val;
}
} }
class RouterConfig class RouterConfig

@ -2,7 +2,7 @@
#define LLARP_LINK_LAYER_HPP #define LLARP_LINK_LAYER_HPP
#include <util/types.hpp> #include <util/types.hpp>
#include <stdlib.h> #include <cstdlib>
constexpr size_t MAX_LINK_MSG_SIZE = 8192; constexpr size_t MAX_LINK_MSG_SIZE = 8192;
constexpr llarp_time_t DefaultLinkSessionLifetime = 60 * 1000; constexpr llarp_time_t DefaultLinkSessionLifetime = 60 * 1000;

@ -19,7 +19,7 @@
#include <absl/strings/str_split.h> #include <absl/strings/str_split.h>
#include <cxxopts.hpp> #include <cxxopts.hpp>
#include <signal.h> #include <csignal>
#if(__FreeBSD__) || (__OpenBSD__) || (__NetBSD__) #if(__FreeBSD__) || (__OpenBSD__) || (__NetBSD__)
#include <pthread_np.h> #include <pthread_np.h>
@ -27,9 +27,7 @@
namespace llarp namespace llarp
{ {
Context::Context() Context::Context() = default;
{
}
Context::~Context() Context::~Context()
{ {
@ -421,8 +419,8 @@ extern "C"
{ {
cSetLogLevel(eLogDebug); cSetLogLevel(eLogDebug);
} }
llarp_main *m = new llarp_main; auto *m = new llarp_main;
m->ctx = std::make_unique< llarp::Context >(); m->ctx = std::make_unique< llarp::Context >();
if(!m->ctx->LoadConfig(fname)) if(!m->ctx->LoadConfig(fname))
{ {
m->ctx->Close(); m->ctx->Close();

@ -1,7 +1,7 @@
#ifndef LLARP_CRYPTO_CONSTANTS_HPP #ifndef LLARP_CRYPTO_CONSTANTS_HPP
#define LLARP_CRYPTO_CONSTANTS_HPP #define LLARP_CRYPTO_CONSTANTS_HPP
#include <stdint.h> #include <cstdint>
#include <libntrup/ntru.h> #include <libntrup/ntru.h>

@ -8,8 +8,8 @@
#include <absl/base/optimization.h> #include <absl/base/optimization.h>
#include <functional> #include <functional>
#include <stdbool.h>
#include <stdint.h> #include <cstdint>
/** /**
* crypto.hpp * crypto.hpp
@ -89,9 +89,7 @@ namespace llarp
pqe_encrypt(PQCipherBlock &, SharedSecret &, const PQPubKey &) = 0; pqe_encrypt(PQCipherBlock &, SharedSecret &, const PQPubKey &) = 0;
}; };
inline Crypto::~Crypto() inline Crypto::~Crypto() = default;
{
}
/// return random 64bit unsigned interger /// return random 64bit unsigned interger
uint64_t uint64_t

@ -5,7 +5,7 @@
#include <sodium/crypto_stream_xchacha20.h> #include <sodium/crypto_stream_xchacha20.h>
#include <util/mem.hpp> #include <util/mem.hpp>
#include <assert.h> #include <cassert>
extern "C" extern "C"
{ {

@ -11,9 +11,7 @@ namespace llarp
{ {
CryptoLibSodium(); CryptoLibSodium();
~CryptoLibSodium() ~CryptoLibSodium() override = default;
{
}
/// xchacha symmetric cipher /// xchacha symmetric cipher
bool bool

@ -20,7 +20,7 @@ namespace llarp
{ {
} }
~NoOpCrypto() = default; ~NoOpCrypto() override = default;
bool bool
xchacha20(const llarp_buffer_t &, const SharedSecret &, xchacha20(const llarp_buffer_t &, const SharedSecret &,

@ -4,6 +4,7 @@
#include <crypto/encrypted.hpp> #include <crypto/encrypted.hpp>
#include <crypto/types.hpp> #include <crypto/types.hpp>
#include <util/buffer.hpp> #include <util/buffer.hpp>
#include <utility>
#include <util/mem.h> #include <util/mem.h>
#include <util/threadpool.h> #include <util/threadpool.h>
@ -60,8 +61,7 @@ namespace llarp
static void static void
Decrypt(void* user) Decrypt(void* user)
{ {
AsyncFrameDecrypter< User >* ctx = auto* ctx = static_cast< AsyncFrameDecrypter< User >* >(user);
static_cast< AsyncFrameDecrypter< User >* >(user);
if(ctx->target.DecryptInPlace(ctx->seckey)) if(ctx->target.DecryptInPlace(ctx->seckey))
{ {
@ -75,7 +75,7 @@ namespace llarp
} }
AsyncFrameDecrypter(const SecretKey& secretkey, DecryptHandler h) AsyncFrameDecrypter(const SecretKey& secretkey, DecryptHandler h)
: result(h), seckey(secretkey) : result(std::move(h)), seckey(secretkey)
{ {
} }

@ -19,7 +19,8 @@ namespace llarp
using BucketStorage_t = std::map< Key_t, Val_t, XorMetric >; using BucketStorage_t = std::map< Key_t, Val_t, XorMetric >;
using Random_t = std::function< uint64_t() >; using Random_t = std::function< uint64_t() >;
Bucket(const Key_t& us, Random_t r) : nodes(XorMetric(us)), random(r) Bucket(const Key_t& us, Random_t r)
: nodes(XorMetric(us)), random(std::move(r))
{ {
} }

@ -26,17 +26,13 @@ namespace llarp
{ {
namespace dht namespace dht
{ {
AbstractContext::~AbstractContext() AbstractContext::~AbstractContext() = default;
{
}
struct Context final : public AbstractContext struct Context final : public AbstractContext
{ {
Context(); Context();
~Context() ~Context() override = default;
{
}
util::StatusObject util::StatusObject
ExtractStatus() const override; ExtractStatus() const override;
@ -167,7 +163,7 @@ namespace llarp
void void
Explore(size_t N = 3); Explore(size_t N = 3);
llarp::AbstractRouter* router; llarp::AbstractRouter* router{nullptr};
// for router contacts // for router contacts
std::unique_ptr< Bucket< RCNode > > _nodes; std::unique_ptr< Bucket< RCNode > > _nodes;
@ -180,7 +176,7 @@ namespace llarp
return _services.get(); return _services.get();
} }
bool allowTransit; bool allowTransit{false};
bool& bool&
AllowTransit() override AllowTransit() override
@ -308,7 +304,7 @@ namespace llarp
Key_t ourKey; Key_t ourKey;
}; };
Context::Context() : router(nullptr), allowTransit(false) Context::Context()
{ {
randombytes((byte_t*)&ids, sizeof(uint64_t)); randombytes((byte_t*)&ids, sizeof(uint64_t));
} }
@ -346,7 +342,7 @@ namespace llarp
{ {
if(left) if(left)
return; return;
Context* ctx = static_cast< Context* >(u); auto* ctx = static_cast< Context* >(u);
const auto num = const auto num =
std::min(ctx->router->NumberOfConnectedRouters(), size_t(4)); std::min(ctx->router->NumberOfConnectedRouters(), size_t(4));
if(num) if(num)
@ -361,7 +357,7 @@ namespace llarp
{ {
if(left) if(left)
return; return;
Context* ctx = static_cast< Context* >(u); auto* ctx = static_cast< Context* >(u);
// clean up transactions // clean up transactions
ctx->CleanupTX(); ctx->CleanupTX();

@ -33,7 +33,7 @@ llarp_dht_context_start(struct llarp_dht_context* ctx, const byte_t* key);
// remove this? dns needs it atm // remove this? dns needs it atm
struct llarp_router_lookup_job; struct llarp_router_lookup_job;
typedef void (*llarp_router_lookup_handler)(struct llarp_router_lookup_job*); using llarp_router_lookup_handler = void (*)(struct llarp_router_lookup_job*);
struct llarp_router_lookup_job struct llarp_router_lookup_job
{ {

@ -1,5 +1,6 @@
#include <dht/context.hpp> #include <dht/context.hpp>
#include <memory>
#include <util/bencode.hpp> #include <util/bencode.hpp>
#include <dht/messages/findintro.hpp> #include <dht/messages/findintro.hpp>
#include <dht/messages/findrouter.hpp> #include <dht/messages/findrouter.hpp>
@ -46,29 +47,29 @@ namespace llarp
switch(*strbuf.base) switch(*strbuf.base)
{ {
case 'F': case 'F':
msg.reset(new FindIntroMessage(From, relayed)); msg = std::make_unique< FindIntroMessage >(From, relayed);
break; break;
case 'R': case 'R':
if(relayed) if(relayed)
msg.reset(new RelayedFindRouterMessage(From)); msg = std::make_unique< RelayedFindRouterMessage >(From);
else else
msg.reset(new FindRouterMessage(From)); msg = std::make_unique< FindRouterMessage >(From);
break; break;
case 'S': case 'S':
msg.reset(new GotRouterMessage(From, relayed)); msg = std::make_unique< GotRouterMessage >(From, relayed);
break; break;
case 'I': case 'I':
msg.reset(new PublishIntroMessage()); msg = std::make_unique< PublishIntroMessage >();
break; break;
case 'G': case 'G':
if(relayed) if(relayed)
{ {
msg.reset(new RelayedGotIntroMessage()); msg = std::make_unique< RelayedGotIntroMessage >();
break; break;
} }
else else
{ {
msg.reset(new GotIntroMessage(From)); msg = std::make_unique< GotIntroMessage >(From);
break; break;
} }
default: default:

@ -16,9 +16,7 @@ namespace llarp
struct IMessage struct IMessage
{ {
virtual ~IMessage() virtual ~IMessage() = default;
{
}
/// construct /// construct
IMessage(const Key_t& from) : From(from) IMessage(const Key_t& from) : From(from)

@ -7,9 +7,7 @@ namespace llarp
{ {
namespace dht namespace dht
{ {
FindIntroMessage::~FindIntroMessage() FindIntroMessage::~FindIntroMessage() = default;
{
}
bool bool
FindIntroMessage::DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) FindIntroMessage::DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val)

@ -45,7 +45,7 @@ namespace llarp
R = 1; R = 1;
} }
~FindIntroMessage(); ~FindIntroMessage() override;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;

@ -57,9 +57,7 @@ namespace llarp
return true; return true;
} }
FindRouterMessage::~FindRouterMessage() FindRouterMessage::~FindRouterMessage() = default;
{
}
bool bool
FindRouterMessage::BEncode(llarp_buffer_t *buf) const FindRouterMessage::BEncode(llarp_buffer_t *buf) const
@ -183,8 +181,8 @@ namespace llarp
replies.emplace_back(new GotRouterMessage(k, txid, {found}, false)); replies.emplace_back(new GotRouterMessage(k, txid, {found}, false));
return true; return true;
} }
else
dht.LookupRouterRelayed(From, txid, k, !iterative, replies); dht.LookupRouterRelayed(From, txid, k, !iterative, replies);
return true; return true;
} }
} // namespace dht } // namespace dht

@ -25,7 +25,7 @@ namespace llarp
K.Randomize(); K.Randomize();
} }
~FindRouterMessage(); ~FindRouterMessage() override;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -33,7 +33,7 @@ namespace llarp
bool bool
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
virtual bool bool
HandleMessage( HandleMessage(
llarp_dht_context* ctx, llarp_dht_context* ctx,
std::vector< std::unique_ptr< IMessage > >& replies) const override; std::vector< std::unique_ptr< IMessage > >& replies) const override;
@ -55,7 +55,7 @@ namespace llarp
/// handle a relayed FindRouterMessage, do a lookup on the dht and inform /// handle a relayed FindRouterMessage, do a lookup on the dht and inform
/// the path of the result /// the path of the result
/// TODO: smart path expiration logic needs to be implemented /// TODO: smart path expiration logic needs to be implemented
virtual bool bool
HandleMessage(llarp_dht_context* ctx, HandleMessage(llarp_dht_context* ctx,
std::vector< IMessage::Ptr_t >& replies) const override; std::vector< IMessage::Ptr_t >& replies) const override;
}; };

@ -1,29 +1,27 @@
#include <dht/messages/gotintro.hpp> #include <dht/messages/gotintro.hpp>
#include <dht/context.hpp> #include <dht/context.hpp>
#include <memory>
#include <path/path_context.hpp> #include <path/path_context.hpp>
#include <router/abstractrouter.hpp> #include <router/abstractrouter.hpp>
#include <routing/dht_message.hpp> #include <routing/dht_message.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
namespace dht namespace dht
{ {
GotIntroMessage::GotIntroMessage( GotIntroMessage::GotIntroMessage(std::vector< service::IntroSet > results,
const std::vector< llarp::service::IntroSet > &results, uint64_t tx) uint64_t tx)
: IMessage({}), I(results), T(tx) : IMessage({}), I(std::move(results)), T(tx)
{
}
GotIntroMessage::~GotIntroMessage()
{ {
} }
bool bool
GotIntroMessage::HandleMessage( GotIntroMessage::HandleMessage(
llarp_dht_context *ctx, llarp_dht_context *ctx,
__attribute__((unused)) ABSL_ATTRIBUTE_UNUSED std::vector< std::unique_ptr< IMessage > >
std::vector< std::unique_ptr< IMessage > > &replies) const &replies) const
{ {
auto &dht = *ctx->impl; auto &dht = *ctx->impl;
@ -31,7 +29,7 @@ namespace llarp
{ {
if(!introset.Verify(dht.Now())) if(!introset.Verify(dht.Now()))
{ {
llarp::LogWarn( LogWarn(
"Invalid introset while handling direct GotIntro " "Invalid introset while handling direct GotIntro "
"from ", "from ",
From); From);
@ -59,7 +57,7 @@ namespace llarp
} }
return true; return true;
} }
llarp::LogError("no pending TX for GIM from ", From, " txid=", T); LogError("no pending TX for GIM from ", From, " txid=", T);
return false; return false;
} }
@ -77,7 +75,7 @@ namespace llarp
auto copy = std::make_shared< const RelayedGotIntroMessage >(*this); auto copy = std::make_shared< const RelayedGotIntroMessage >(*this);
return pathset->HandleGotIntroMessage(copy); return pathset->HandleGotIntroMessage(copy);
} }
llarp::LogWarn("No path for got intro message pathid=", pathID); LogWarn("No path for got intro message pathid=", pathID);
return false; return false;
} }
@ -92,7 +90,7 @@ namespace llarp
{ {
if(K) // duplicate key? if(K) // duplicate key?
return false; return false;
K.reset(new dht::Key_t()); K = std::make_unique< dht::Key_t >();
return K->BDecode(buf); return K->BDecode(buf);
} }
bool read = false; bool read = false;

@ -15,7 +15,7 @@ namespace llarp
struct GotIntroMessage : public IMessage struct GotIntroMessage : public IMessage
{ {
/// the found introsets /// the found introsets
std::vector< llarp::service::IntroSet > I; std::vector< service::IntroSet > I;
/// txid /// txid
uint64_t T = 0; uint64_t T = 0;
/// the key of a router closer in keyspace if iterative lookup /// the key of a router closer in keyspace if iterative lookup
@ -41,10 +41,9 @@ namespace llarp
} }
/// for recursive reply /// for recursive reply
GotIntroMessage(const std::vector< llarp::service::IntroSet >& results, GotIntroMessage(std::vector< service::IntroSet > results, uint64_t txid);
uint64_t txid);
~GotIntroMessage(); ~GotIntroMessage() override = default;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -52,7 +51,7 @@ namespace llarp
bool bool
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
virtual bool bool
HandleMessage(llarp_dht_context* ctx, HandleMessage(llarp_dht_context* ctx,
std::vector< IMessage::Ptr_t >& replies) const override; std::vector< IMessage::Ptr_t >& replies) const override;
}; };

@ -1,6 +1,7 @@
#include <dht/context.hpp> #include <dht/context.hpp>
#include <dht/messages/gotrouter.hpp> #include <dht/messages/gotrouter.hpp>
#include <memory>
#include <path/path_context.hpp> #include <path/path_context.hpp>
#include <router/abstractrouter.hpp> #include <router/abstractrouter.hpp>
@ -8,9 +9,7 @@ namespace llarp
{ {
namespace dht namespace dht
{ {
GotRouterMessage::~GotRouterMessage() GotRouterMessage::~GotRouterMessage() = default;
{
}
bool bool
GotRouterMessage::BEncode(llarp_buffer_t *buf) const GotRouterMessage::BEncode(llarp_buffer_t *buf) const
@ -56,7 +55,7 @@ namespace llarp
{ {
if(K) // duplicate key? if(K) // duplicate key?
return false; return false;
K.reset(new dht::Key_t()); K = std::make_unique< dht::Key_t >();
return K->BDecode(val); return K->BDecode(val);
} }
if(key == "N") if(key == "N")

@ -1,8 +1,11 @@
#ifndef LLARP_DHT_MESSAGES_GOT_ROUTER_HPP #ifndef LLARP_DHT_MESSAGES_GOT_ROUTER_HPP
#define LLARP_DHT_MESSAGES_GOT_ROUTER_HPP #define LLARP_DHT_MESSAGES_GOT_ROUTER_HPP
#include <dht/message.hpp> #include <dht/message.hpp>
#include <router_contact.hpp> #include <router_contact.hpp>
#include <util/copy_or_nullptr.hpp> #include <util/copy_or_nullptr.hpp>
#include <utility>
#include <vector>
namespace llarp namespace llarp
{ {
@ -15,9 +18,8 @@ namespace llarp
{ {
} }
GotRouterMessage(const Key_t& from, uint64_t id, GotRouterMessage(const Key_t& from, uint64_t id,
const std::vector< RouterContact >& results, std::vector< RouterContact > results, bool tunneled)
bool tunneled) : IMessage(from), R(std::move(results)), txid(id), relayed(tunneled)
: IMessage(from), R(results), txid(id), relayed(tunneled)
{ {
} }
@ -27,9 +29,9 @@ namespace llarp
{ {
} }
GotRouterMessage(uint64_t id, const std::vector< RouterID >& near, GotRouterMessage(uint64_t id, std::vector< RouterID > _near,
bool tunneled) bool tunneled)
: IMessage({}), N(near), txid(id), relayed(tunneled) : IMessage({}), N(std::move(_near)), txid(id), relayed(tunneled)
{ {
} }
@ -44,7 +46,7 @@ namespace llarp
version = other.version; version = other.version;
} }
~GotRouterMessage(); ~GotRouterMessage() override;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -52,7 +54,7 @@ namespace llarp
bool bool
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
virtual bool bool
HandleMessage( HandleMessage(
llarp_dht_context* ctx, llarp_dht_context* ctx,
std::vector< std::unique_ptr< IMessage > >& replies) const override; std::vector< std::unique_ptr< IMessage > >& replies) const override;

@ -10,9 +10,7 @@ namespace llarp
{ {
namespace dht namespace dht
{ {
PublishIntroMessage::~PublishIntroMessage() PublishIntroMessage::~PublishIntroMessage() = default;
{
}
bool bool
PublishIntroMessage::DecodeKey(const llarp_buffer_t &key, PublishIntroMessage::DecodeKey(const llarp_buffer_t &key,

@ -3,6 +3,7 @@
#include <dht/message.hpp> #include <dht/message.hpp>
#include <service/intro_set.hpp> #include <service/intro_set.hpp>
#include <utility>
#include <vector> #include <vector>
namespace llarp namespace llarp
@ -22,14 +23,14 @@ namespace llarp
} }
PublishIntroMessage(const llarp::service::IntroSet& i, uint64_t tx, PublishIntroMessage(const llarp::service::IntroSet& i, uint64_t tx,
uint64_t s, const std::vector< Key_t >& exclude = {}) uint64_t s, std::vector< Key_t > exclude = {})
: IMessage({}), E(exclude), txID(tx) : IMessage({}), E(std::move(exclude)), txID(tx)
{ {
I = i; I = i;
S = s; S = s;
} }
~PublishIntroMessage(); ~PublishIntroMessage() override;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -37,7 +38,7 @@ namespace llarp
bool bool
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
virtual bool bool
HandleMessage( HandleMessage(
llarp_dht_context* ctx, llarp_dht_context* ctx,
std::vector< std::unique_ptr< IMessage > >& replies) const override; std::vector< std::unique_ptr< IMessage > >& replies) const override;

@ -4,6 +4,7 @@
#include <dht/key.hpp> #include <dht/key.hpp>
#include <router_contact.hpp> #include <router_contact.hpp>
#include <service/intro_set.hpp> #include <service/intro_set.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -47,7 +48,7 @@ namespace llarp
ID.Zero(); ID.Zero();
} }
ISNode(const service::IntroSet& other) : introset(other) ISNode(service::IntroSet other) : introset(std::move(other))
{ {
introset.A.CalculateAddress(ID.as_array()); introset.A.CalculateAddress(ID.as_array());
} }

@ -2,6 +2,7 @@
#include <dht/context.hpp> #include <dht/context.hpp>
#include <dht/messages/pubintro.hpp> #include <dht/messages/pubintro.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -10,11 +11,11 @@ namespace llarp
PublishServiceJob::PublishServiceJob(const TXOwner &asker, PublishServiceJob::PublishServiceJob(const TXOwner &asker,
const service::IntroSet &introset, const service::IntroSet &introset,
AbstractContext *ctx, uint64_t s, AbstractContext *ctx, uint64_t s,
const std::set< Key_t > &exclude) std::set< Key_t > exclude)
: TX< service::Address, service::IntroSet >(asker, introset.A.Addr(), : TX< service::Address, service::IntroSet >(asker, introset.A.Addr(),
ctx) ctx)
, S(s) , S(s)
, dontTell(exclude) , dontTell(std::move(exclude))
, I(introset) , I(introset)
{ {
} }

@ -20,7 +20,7 @@ namespace llarp
PublishServiceJob(const TXOwner &asker, const service::IntroSet &introset, PublishServiceJob(const TXOwner &asker, const service::IntroSet &introset,
AbstractContext *ctx, uint64_t s, AbstractContext *ctx, uint64_t s,
const std::set< Key_t > &exclude); std::set< Key_t > exclude);
bool bool
Validate(const service::IntroSet &introset) const override; Validate(const service::IntroSet &introset) const override;

@ -3,6 +3,7 @@
#include <dht/context.hpp> #include <dht/context.hpp>
#include <dht/messages/findrouter.hpp> #include <dht/messages/findrouter.hpp>
#include <dht/messages/gotrouter.hpp> #include <dht/messages/gotrouter.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -13,7 +14,7 @@ namespace llarp
AbstractContext *ctx, AbstractContext *ctx,
RouterLookupHandler result) RouterLookupHandler result)
: TX< RouterID, RouterContact >(_whoasked, _target, ctx) : TX< RouterID, RouterContact >(_whoasked, _target, ctx)
, resultHandler(result) , resultHandler(std::move(result))
{ {
peersAsked.insert(ctx->OurKey()); peersAsked.insert(ctx->OurKey());

@ -28,7 +28,7 @@ namespace llarp
void void
Start(const TXOwner &peer) override; Start(const TXOwner &peer) override;
virtual void void
SendReply() override; SendReply() override;
}; };
} // namespace dht } // namespace dht

@ -3,6 +3,7 @@
#include <dht/context.hpp> #include <dht/context.hpp>
#include <dht/messages/findintro.hpp> #include <dht/messages/findintro.hpp>
#include <dht/messages/gotintro.hpp> #include <dht/messages/gotintro.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -13,7 +14,7 @@ namespace llarp
AbstractContext *ctx, uint64_t r, AbstractContext *ctx, uint64_t r,
service::IntroSetLookupHandler handler) service::IntroSetLookupHandler handler)
: TX< service::Address, service::IntroSet >(asker, addr, ctx) : TX< service::Address, service::IntroSet >(asker, addr, ctx)
, handleResult(handler) , handleResult(std::move(handler))
, R(r) , R(r)
{ {
peersAsked.insert(ctx->OurKey()); peersAsked.insert(ctx->OurKey());

@ -34,7 +34,7 @@ namespace llarp
void void
DoNextRequest(const Key_t &ask) override; DoNextRequest(const Key_t &ask) override;
virtual void void
SendReply() override; SendReply() override;
}; };
} // namespace dht } // namespace dht

@ -29,9 +29,7 @@ namespace llarp
{ {
} }
virtual ~TX() virtual ~TX() = default;
{
}
void void
OnFound(const Key_t& askedPeer, const V& value); OnFound(const Key_t& askedPeer, const V& value);

@ -96,7 +96,7 @@ getDNSstring(const char *const buffer, uint32_t *pos)
} }
void void
code_domain(char *&buffer, const std::string &domain) throw() code_domain(char *&buffer, const std::string &domain) noexcept
{ {
std::string::size_type start(0); std::string::size_type start(0);
std::string::size_type end; // indexes std::string::size_type end; // indexes
@ -124,7 +124,7 @@ code_domain(char *&buffer, const std::string &domain) throw()
} }
void void
vcode_domain(std::vector< byte_t > &bytes, const std::string &domain) throw() vcode_domain(std::vector< byte_t > &bytes, const std::string &domain) noexcept
{ {
std::string::size_type start(0); std::string::size_type start(0);
std::string::size_type end; // indexes std::string::size_type end; // indexes
@ -153,7 +153,7 @@ vcode_domain(std::vector< byte_t > &bytes, const std::string &domain) throw()
// expects host order // expects host order
void void
vput16bits(std::vector< byte_t > &bytes, uint16_t value) throw() vput16bits(std::vector< byte_t > &bytes, uint16_t value) noexcept
{ {
char buf[2] = {0}; char buf[2] = {0};
char *write_buffer = buf; char *write_buffer = buf;
@ -164,7 +164,7 @@ vput16bits(std::vector< byte_t > &bytes, uint16_t value) throw()
// expects host order // expects host order
void void
vput32bits(std::vector< byte_t > &bytes, uint32_t value) throw() vput32bits(std::vector< byte_t > &bytes, uint32_t value) noexcept
{ {
char buf[4] = {0}; char buf[4] = {0};
char *write_buffer = buf; char *write_buffer = buf;
@ -178,7 +178,7 @@ vput32bits(std::vector< byte_t > &bytes, uint32_t value) throw()
void void
dns_writeType(std::vector< byte_t > &bytes, llarp::dns::record *record) dns_writeType(std::vector< byte_t > &bytes, llarp::dns::record *record)
{ {
llarp::dns::type_1a *type1a = dynamic_cast< llarp::dns::type_1a * >(record); auto *type1a = dynamic_cast< llarp::dns::type_1a * >(record);
if(type1a) if(type1a)
{ {
std::vector< byte_t > more_bytes = type1a->to_bytes(); std::vector< byte_t > more_bytes = type1a->to_bytes();
@ -186,8 +186,7 @@ dns_writeType(std::vector< byte_t > &bytes, llarp::dns::record *record)
bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end()); bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end());
} }
llarp::dns::type_2ns *type2ns = auto *type2ns = dynamic_cast< llarp::dns::type_2ns * >(record);
dynamic_cast< llarp::dns::type_2ns * >(record);
if(type2ns) if(type2ns)
{ {
std::vector< byte_t > more_bytes = type2ns->to_bytes(); std::vector< byte_t > more_bytes = type2ns->to_bytes();
@ -195,8 +194,7 @@ dns_writeType(std::vector< byte_t > &bytes, llarp::dns::record *record)
bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end()); bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end());
} }
llarp::dns::type_5cname *type5cname = auto *type5cname = dynamic_cast< llarp::dns::type_5cname * >(record);
dynamic_cast< llarp::dns::type_5cname * >(record);
if(type5cname) if(type5cname)
{ {
std::vector< byte_t > more_bytes = type5cname->to_bytes(); std::vector< byte_t > more_bytes = type5cname->to_bytes();
@ -204,24 +202,21 @@ dns_writeType(std::vector< byte_t > &bytes, llarp::dns::record *record)
bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end()); bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end());
} }
llarp::dns::type_12ptr *type12ptr = auto *type12ptr = dynamic_cast< llarp::dns::type_12ptr * >(record);
dynamic_cast< llarp::dns::type_12ptr * >(record);
if(type12ptr) if(type12ptr)
{ {
std::vector< byte_t > more_bytes = type12ptr->to_bytes(); std::vector< byte_t > more_bytes = type12ptr->to_bytes();
llarp::LogDebug("[12]Adding ", more_bytes.size()); llarp::LogDebug("[12]Adding ", more_bytes.size());
bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end()); bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end());
} }
llarp::dns::type_15mx *type15mx = auto *type15mx = dynamic_cast< llarp::dns::type_15mx * >(record);
dynamic_cast< llarp::dns::type_15mx * >(record);
if(type15mx) if(type15mx)
{ {
std::vector< byte_t > more_bytes = type15mx->to_bytes(); std::vector< byte_t > more_bytes = type15mx->to_bytes();
llarp::LogDebug("[15]Adding ", more_bytes.size()); llarp::LogDebug("[15]Adding ", more_bytes.size());
bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end()); bytes.insert(bytes.end(), more_bytes.begin(), more_bytes.end());
} }
llarp::dns::type_16txt *type16txt = auto *type16txt = dynamic_cast< llarp::dns::type_16txt * >(record);
dynamic_cast< llarp::dns::type_16txt * >(record);
if(type16txt) if(type16txt)
{ {
std::vector< byte_t > more_bytes = type16txt->to_bytes(); std::vector< byte_t > more_bytes = type16txt->to_bytes();
@ -292,7 +287,7 @@ packet2bytes(dns_packet &in)
extern "C" extern "C"
{ {
uint16_t uint16_t
get16bits(const char *&buffer) throw() get16bits(const char *&buffer) noexcept
{ {
uint16_t value = bufbe16toh(buffer); uint16_t value = bufbe16toh(buffer);
buffer += 2; buffer += 2;
@ -300,7 +295,7 @@ extern "C"
} }
uint32_t uint32_t
get32bits(const char *&buffer) throw() get32bits(const char *&buffer) noexcept
{ {
uint32_t value = bufbe32toh(buffer); uint32_t value = bufbe32toh(buffer);
buffer += 4; buffer += 4;
@ -350,7 +345,7 @@ extern "C"
dns_msg_question * dns_msg_question *
decode_question(const char *buffer, uint32_t *pos) decode_question(const char *buffer, uint32_t *pos)
{ {
dns_msg_question *question = new dns_msg_question; auto *question = new dns_msg_question;
std::string m_qName = getDNSstring(buffer, pos); std::string m_qName = getDNSstring(buffer, pos);
llarp::LogDebug("Got question name: ", m_qName); llarp::LogDebug("Got question name: ", m_qName);
@ -369,7 +364,7 @@ extern "C"
dns_msg_answer * dns_msg_answer *
decode_answer(const char *const buffer, uint32_t *pos) decode_answer(const char *const buffer, uint32_t *pos)
{ {
dns_msg_answer *answer = new dns_msg_answer; auto *answer = new dns_msg_answer;
/* /*
llarp_buffer_t bob; llarp_buffer_t bob;
bob.base = (unsigned char *)buffer; bob.base = (unsigned char *)buffer;
@ -589,14 +584,14 @@ extern "C"
} }
void void
put16bits(char *&buffer, uint16_t value) throw() put16bits(char *&buffer, uint16_t value) noexcept
{ {
htobe16buf(buffer, value); htobe16buf(buffer, value);
buffer += 2; buffer += 2;
} }
void void
put32bits(char *&buffer, uint32_t value) throw() put32bits(char *&buffer, uint32_t value) noexcept
{ {
htobe32buf(buffer, value); htobe32buf(buffer, value);
buffer += 4; buffer += 4;

@ -14,7 +14,7 @@ extern "C"
// fwd declr // fwd declr
struct dnsc_answer_request; struct dnsc_answer_request;
typedef void (*dnsc_answer_hook_func)(dnsc_answer_request *request); using dnsc_answer_hook_func = void (*)(dnsc_answer_request *);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -111,24 +111,24 @@ std::string
getDNSstring(const char *const buffer, uint32_t *pos); getDNSstring(const char *const buffer, uint32_t *pos);
void void
code_domain(char *&buffer, const std::string &domain) throw(); code_domain(char *&buffer, const std::string &domain) noexcept;
void void
vcode_domain(std::vector< byte_t > &bytes, const std::string &domain) throw(); vcode_domain(std::vector< byte_t > &bytes, const std::string &domain) noexcept;
void void
vput16bits(std::vector< byte_t > &bytes, uint16_t value) throw(); vput16bits(std::vector< byte_t > &bytes, uint16_t value) noexcept;
void void
vput32bits(std::vector< byte_t > &bytes, uint32_t value) throw(); vput32bits(std::vector< byte_t > &bytes, uint32_t value) noexcept;
extern "C" extern "C"
{ {
uint16_t uint16_t
get16bits(const char *&buffer) throw(); get16bits(const char *&buffer) noexcept;
uint32_t uint32_t
get32bits(const char *&buffer) throw(); get32bits(const char *&buffer) noexcept;
bool bool
decode_hdr(llarp_buffer_t *buffer, dns_msg_header *hdr); decode_hdr(llarp_buffer_t *buffer, dns_msg_header *hdr);
@ -140,10 +140,10 @@ extern "C"
decode_answer(const char *const buffer, uint32_t *pos); decode_answer(const char *const buffer, uint32_t *pos);
void void
put16bits(char *&buffer, uint16_t value) throw(); put16bits(char *&buffer, uint16_t value) noexcept;
void void
put32bits(char *&buffer, uint32_t value) throw(); put32bits(char *&buffer, uint32_t value) noexcept;
void void
llarp_handle_dns_recvfrom(struct llarp_udp_io *udp, llarp_handle_dns_recvfrom(struct llarp_udp_io *udp,

@ -1,7 +1,7 @@
#ifndef LLARP_DNS_DNS_HPP #ifndef LLARP_DNS_DNS_HPP
#define LLARP_DNS_DNS_HPP #define LLARP_DNS_DNS_HPP
#include <stdint.h> #include <cstdint>
namespace llarp namespace llarp
{ {

@ -107,11 +107,11 @@ namespace llarp
ip = net::IPPacket::ExpandV4(llarp::ipaddr_ipv4_bits(a, b, c, d)); ip = net::IPPacket::ExpandV4(llarp::ipaddr_ipv4_bits(a, b, c, d));
return true; return true;
} }
else if(numdots == 32 && isV6) if(numdots == 32 && isV6)
{ {
size_t idx = 0; size_t idx = 0;
uint8_t lo, hi; uint8_t lo, hi;
uint8_t* ptr = (uint8_t*)&ip.h; auto* ptr = (uint8_t*)&ip.h;
while(idx < 16) while(idx < 16)
{ {
pos = sub.find('.'); pos = sub.find('.');

@ -5,9 +5,7 @@ namespace llarp
{ {
namespace dns namespace dns
{ {
record::~record() record::~record() = default;
{
}
bool bool
record::parse(std::vector< byte_t > bytes) record::parse(std::vector< byte_t > bytes)

@ -13,9 +13,7 @@ namespace llarp
struct record struct record
{ {
virtual ~record() = 0; virtual ~record() = 0;
record() record() = default;
{
}
virtual bool virtual bool
parse(std::vector< byte_t > bytes) = 0; parse(std::vector< byte_t > bytes) = 0;
@ -28,9 +26,7 @@ namespace llarp
{ {
huint32_t ipaddr; huint32_t ipaddr;
virtual ~type_1a() ~type_1a() override = default;
{
}
type_1a(); type_1a();
bool bool
@ -44,9 +40,7 @@ namespace llarp
{ {
std::string ns; std::string ns;
virtual ~type_2ns() ~type_2ns() override = default;
{
}
type_2ns(); type_2ns();
bool bool
@ -66,9 +60,7 @@ namespace llarp
uint32_t expire; uint32_t expire;
uint32_t minimum; uint32_t minimum;
virtual ~type_6soa() ~type_6soa() override = default;
{
}
type_6soa(); type_6soa();
bool bool
@ -82,9 +74,7 @@ namespace llarp
{ {
std::string cname; std::string cname;
virtual ~type_5cname() ~type_5cname() override = default;
{
}
type_5cname(); type_5cname();
bool bool
@ -98,9 +88,7 @@ namespace llarp
{ {
std::string revname; std::string revname;
virtual ~type_12ptr() ~type_12ptr() override = default;
{
}
type_12ptr(); type_12ptr();
bool bool
@ -115,9 +103,7 @@ namespace llarp
std::string mx; std::string mx;
uint16_t priority; uint16_t priority;
virtual ~type_15mx() ~type_15mx() override = default;
{
}
type_15mx(); type_15mx();
bool bool
@ -131,9 +117,7 @@ namespace llarp
{ {
std::string txt; std::string txt;
virtual ~type_16txt() ~type_16txt() override = default;
{
}
type_16txt(); type_16txt();
bool bool

@ -5,9 +5,7 @@ namespace llarp
{ {
namespace dns namespace dns
{ {
Serialize::~Serialize() Serialize::~Serialize() = default;
{
}
bool bool
EncodeRData(llarp_buffer_t* buf, const std::vector< byte_t >& v) EncodeRData(llarp_buffer_t* buf, const std::vector< byte_t >& v)

@ -3,6 +3,7 @@
#include <crypto/crypto.hpp> #include <crypto/crypto.hpp>
#include <util/logic.hpp> #include <util/logic.hpp>
#include <array> #include <array>
#include <utility>
namespace llarp namespace llarp
{ {
@ -11,10 +12,10 @@ namespace llarp
Proxy::Proxy(llarp_ev_loop_ptr serverLoop, Logic_ptr serverLogic, Proxy::Proxy(llarp_ev_loop_ptr serverLoop, Logic_ptr serverLogic,
llarp_ev_loop_ptr clientLoop, Logic_ptr clientLogic, llarp_ev_loop_ptr clientLoop, Logic_ptr clientLogic,
IQueryHandler* h) IQueryHandler* h)
: m_ServerLoop(serverLoop) : m_ServerLoop(std::move(serverLoop))
, m_ClientLoop(clientLoop) , m_ClientLoop(std::move(clientLoop))
, m_ServerLogic(serverLogic) , m_ServerLogic(std::move(serverLogic))
, m_ClientLogic(clientLogic) , m_ClientLogic(std::move(clientLogic))
, m_QueryHandler(h) , m_QueryHandler(h)
{ {
m_Client.user = this; m_Client.user = this;

@ -16,9 +16,7 @@ namespace llarp
/// handler of dns query hooking /// handler of dns query hooking
struct IQueryHandler struct IQueryHandler
{ {
virtual ~IQueryHandler() virtual ~IQueryHandler() = default;
{
}
/// return true if we should hook this message /// return true if we should hook this message
virtual bool virtual bool

@ -10,12 +10,12 @@
#include <unistd.h> /* close */ #include <unistd.h> /* close */
#endif #endif
#include <stdlib.h> /* exit */ #include <cstdlib> /* exit */
#include <string.h> /* memset */ #include <cstring> /* memset */
#include <sys/types.h> #include <sys/types.h>
#include <algorithm> // for std::find_if #include <algorithm> // for std::find_if
#include <stdio.h> // sprintf #include <cstdio> // sprintf
dns_tracker dns_udp_tracker; dns_tracker dns_udp_tracker;
@ -36,8 +36,8 @@ struct dns_query
struct dns_query * struct dns_query *
build_dns_packet(char *url, uint16_t id, uint16_t reqType) build_dns_packet(char *url, uint16_t id, uint16_t reqType)
{ {
dns_query *dnsQuery = new dns_query; auto *dnsQuery = new dns_query;
dnsQuery->length = 12; dnsQuery->length = 12;
// ID // ID
// buffer[0] = (value & 0xFF00) >> 8; // buffer[0] = (value & 0xFF00) >> 8;
// buffer[1] = value & 0xFF; // buffer[1] = value & 0xFF;
@ -505,7 +505,7 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
} }
else if(answer->type == 15) else if(answer->type == 15)
{ {
llarp::dns::type_15mx *record = auto *record =
dynamic_cast< llarp::dns::type_15mx * >(answer->record.get()); dynamic_cast< llarp::dns::type_15mx * >(answer->record.get());
llarp::LogDebug("Resolving MX ", record->mx, "@", record->priority); llarp::LogDebug("Resolving MX ", record->mx, "@", record->priority);
request->found = true; request->found = true;
@ -639,7 +639,7 @@ raw_resolve_host(struct dnsc_context *const dnsc, const char *url,
llarp::LogInfo("response header says it belongs to id #", hdr.id); llarp::LogInfo("response header says it belongs to id #", hdr.id);
// if we sent this out, then there's an id // if we sent this out, then there's an id
struct dns_tracker *tracker = (struct dns_tracker *)dnsc->tracker; auto *tracker = (struct dns_tracker *)dnsc->tracker;
struct dnsc_answer_request *request = tracker->client_request[hdr.id].get(); struct dnsc_answer_request *request = tracker->client_request[hdr.id].get();
if(request) if(request)
@ -675,7 +675,7 @@ llarp_handle_dnsc_recvfrom(struct llarp_udp_io *const udp,
llarp::LogDebug("Header got client responses for id: ", hdr.id); llarp::LogDebug("Header got client responses for id: ", hdr.id);
// if we sent this out, then there's an id // if we sent this out, then there's an id
struct dns_tracker *tracker = (struct dns_tracker *)udp->user; auto *tracker = (struct dns_tracker *)udp->user;
struct dnsc_answer_request *request = tracker->client_request[hdr.id].get(); struct dnsc_answer_request *request = tracker->client_request[hdr.id].get();
// sometimes we'll get double responses // sometimes we'll get double responses
@ -766,8 +766,8 @@ llarp_resolve_host(struct dnsc_context *const dnsc, const char *url,
void void
llarp_host_resolved(dnsc_answer_request *const request) llarp_host_resolved(dnsc_answer_request *const request)
{ {
dns_tracker *tracker = (dns_tracker *)request->context->tracker; auto *tracker = (dns_tracker *)request->context->tracker;
auto val = std::find_if( auto val = std::find_if(
tracker->client_request.begin(), tracker->client_request.end(), tracker->client_request.begin(), tracker->client_request.end(),
[request]( [request](
std::pair< const uint32_t, std::unique_ptr< dnsc_answer_request > > std::pair< const uint32_t, std::unique_ptr< dnsc_answer_request > >

@ -26,7 +26,7 @@ build_dns_packet(char *url, uint16_t id, uint16_t reqType);
/// hook function to handle an dns client request /// hook function to handle an dns client request
// should we pass by llarp::Addr // should we pass by llarp::Addr
// not as long as we're supporting raw // not as long as we're supporting raw
typedef void (*dnsc_answer_hook_func)(dnsc_answer_request *request); using dnsc_answer_hook_func = void (*)(dnsc_answer_request *);
/// struct for dns client requests /// struct for dns client requests
struct dnsc_answer_request struct dnsc_answer_request

@ -27,7 +27,7 @@ ssize_t
llarp_sendto_dns_hook_func(void *sock, const struct sockaddr *from, llarp_sendto_dns_hook_func(void *sock, const struct sockaddr *from,
ManagedBuffer buf) ManagedBuffer buf)
{ {
struct llarp_udp_io *udp = (struct llarp_udp_io *)sock; auto *udp = (struct llarp_udp_io *)sock;
if(!udp) if(!udp)
{ {
llarp::LogWarn("couldnt cast to udp"); llarp::LogWarn("couldnt cast to udp");
@ -333,8 +333,7 @@ writesend_dnss_txtresponse(std::string txt, const struct sockaddr *from,
void void
handle_dnsc_result(dnsc_answer_request *client_request) handle_dnsc_result(dnsc_answer_request *client_request)
{ {
dnsd_question_request *server_request = auto *server_request = (dnsd_question_request *)client_request->user;
(dnsd_question_request *)client_request->user;
if(!server_request) if(!server_request)
{ {
llarp::LogError("Couldn't map client requser user to a server request"); llarp::LogError("Couldn't map client requser user to a server request");
@ -522,7 +521,7 @@ llarp_handle_dnsd_recvfrom(struct llarp_udp_io *udp,
return; return;
} }
// create new request // create new request
dnsd_question_request *llarp_dns_request = new dnsd_question_request; auto *llarp_dns_request = new dnsd_question_request;
llarp_dns_request->context = dns_udp_tracker.dnsd; // set context llarp_dns_request->context = dns_udp_tracker.dnsd; // set context
llarp_dns_request->from = llarp_dns_request->from =
new sockaddr(*saddr); // make a copy of the sockaddr new sockaddr(*saddr); // make a copy of the sockaddr
@ -543,7 +542,7 @@ raw_handle_recvfrom(int *sockfd, const struct sockaddr *saddr,
llarp::LogError("No tracker set in dnsd context"); llarp::LogError("No tracker set in dnsd context");
return; return;
} }
dnsd_question_request *llarp_dns_request = new dnsd_question_request; auto *llarp_dns_request = new dnsd_question_request;
llarp_dns_request->context = dns_udp_tracker.dnsd; // set context llarp_dns_request->context = dns_udp_tracker.dnsd; // set context
llarp_dns_request->from = llarp_dns_request->from =
new sockaddr(*saddr); // make a copy of the sockaddr new sockaddr(*saddr); // make a copy of the sockaddr

@ -23,9 +23,9 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <memory> #include <memory>
#include <stdbool.h>
#include <stdint.h> #include <cstdint>
#include <stdlib.h> #include <cstdlib>
#if !defined(WIN32) #if !defined(WIN32)
#include <uv.h> #include <uv.h>

@ -16,6 +16,7 @@
#include <deque> #include <deque>
#include <list> #include <list>
#include <future> #include <future>
#include <utility>
#ifdef _WIN32 #ifdef _WIN32
#include <win32/win32_up.h> #include <win32/win32_up.h>
@ -305,7 +306,7 @@ namespace llarp
struct GetNow struct GetNow
{ {
llarp_ev_loop_ptr loop; llarp_ev_loop_ptr loop;
GetNow(llarp_ev_loop_ptr l) : loop(l) GetNow(llarp_ev_loop_ptr l) : loop(std::move(l))
{ {
} }
@ -319,7 +320,7 @@ namespace llarp
struct PutTime struct PutTime
{ {
llarp_ev_loop_ptr loop; llarp_ev_loop_ptr loop;
PutTime(llarp_ev_loop_ptr l) : loop(l) PutTime(llarp_ev_loop_ptr l) : loop(std::move(l))
{ {
} }
void void
@ -570,9 +571,7 @@ namespace llarp
tcp.close = &DoClose; tcp.close = &DoClose;
} }
virtual ~tcp_conn() ~tcp_conn() override = default;
{
}
/// start connecting /// start connecting
void void
@ -631,10 +630,10 @@ namespace llarp
errno = 0; errno = 0;
} }
virtual ssize_t ssize_t
do_write(void* buf, size_t sz) override; do_write(void* buf, size_t sz) override;
virtual int int
read(byte_t* buf, size_t sz) override; read(byte_t* buf, size_t sz) override;
bool bool
@ -652,7 +651,7 @@ namespace llarp
} }
bool bool
tick() tick() override
{ {
if(tcp->tick) if(tcp->tick)
tcp->tick(tcp); tcp->tick(tcp);
@ -660,8 +659,8 @@ namespace llarp
} }
/// actually does accept() :^) /// actually does accept() :^)
virtual int int
read(byte_t*, size_t); read(byte_t*, size_t) override;
}; };
} // namespace llarp } // namespace llarp
@ -784,9 +783,7 @@ struct llarp_ev_loop
return conn && add_ev(conn, true); return conn && add_ev(conn, true);
} }
virtual ~llarp_ev_loop() virtual ~llarp_ev_loop() = default;
{
}
std::list< std::unique_ptr< llarp::ev_io > > handlers; std::list< std::unique_ptr< llarp::ev_io > > handlers;

@ -1,7 +1,7 @@
#include <ev/ev_libuv.hpp> #include <ev/ev_libuv.hpp>
#include <net/net_addr.hpp> #include <net/net_addr.hpp>
#include <string.h> #include <cstring>
namespace libuv namespace libuv
{ {
@ -65,7 +65,7 @@ namespace libuv
static void static void
OnOutboundConnect(uv_connect_t* c, int status) OnOutboundConnect(uv_connect_t* c, int status)
{ {
conn_glue* self = static_cast< conn_glue* >(c->data); auto* self = static_cast< conn_glue* >(c->data);
self->HandleConnectResult(status); self->HandleConnectResult(status);
c->data = nullptr; c->data = nullptr;
} }
@ -181,9 +181,9 @@ namespace libuv
{ {
m_WriteQueue.emplace_back(sz); m_WriteQueue.emplace_back(sz);
std::copy_n(data, sz, m_WriteQueue.back().begin()); std::copy_n(data, sz, m_WriteQueue.back().begin());
auto buf = uv_buf_init(m_WriteQueue.back().data(), sz); auto buf = uv_buf_init(m_WriteQueue.back().data(), sz);
uv_write_t* req = new uv_write_t(); auto* req = new uv_write_t();
req->data = this; req->data = this;
return uv_write(req, Stream(), &buf, 1, &OnWritten) == 0 ? sz : 0; return uv_write(req, Stream(), &buf, 1, &OnWritten) == 0 ? sz : 0;
} }
@ -196,8 +196,8 @@ namespace libuv
static void static void
FullClose(uv_handle_t* h) FullClose(uv_handle_t* h)
{ {
conn_glue* self = static_cast< conn_glue* >(h->data); auto* self = static_cast< conn_glue* >(h->data);
h->data = nullptr; h->data = nullptr;
delete self; delete self;
llarp::LogInfo("deleted"); llarp::LogInfo("deleted");
} }
@ -225,7 +225,7 @@ namespace libuv
OnShutdown(uv_shutdown_t* shut, int code) OnShutdown(uv_shutdown_t* shut, int code)
{ {
llarp::LogDebug("shut down ", code); llarp::LogDebug("shut down ", code);
conn_glue* self = static_cast< conn_glue* >(shut->data); auto* self = static_cast< conn_glue* >(shut->data);
uv_close((uv_handle_t*)&self->m_Handle, &OnClosed); uv_close((uv_handle_t*)&self->m_Handle, &OnClosed);
delete shut; delete shut;
} }
@ -236,8 +236,8 @@ namespace libuv
llarp::LogDebug("close tcp connection"); llarp::LogDebug("close tcp connection");
uv_check_stop(&m_Ticker); uv_check_stop(&m_Ticker);
uv_read_stop(Stream()); uv_read_stop(Stream());
uv_shutdown_t* shut = new uv_shutdown_t(); auto* shut = new uv_shutdown_t();
shut->data = this; shut->data = this;
uv_shutdown(shut, Stream(), &OnShutdown); uv_shutdown(shut, Stream(), &OnShutdown);
} }
@ -285,7 +285,7 @@ namespace libuv
{ {
if(m_Accept && m_Accept->accepted) if(m_Accept && m_Accept->accepted)
{ {
conn_glue* child = new conn_glue(this); auto* child = new conn_glue(this);
llarp::LogDebug("accepted new connection"); llarp::LogDebug("accepted new connection");
child->m_Conn.impl = child; child->m_Conn.impl = child;
child->m_Conn.loop = m_Accept->loop; child->m_Conn.loop = m_Accept->loop;
@ -375,7 +375,7 @@ namespace libuv
static int static int
SendTo(llarp_udp_io* udp, const sockaddr* to, const byte_t* ptr, size_t sz) SendTo(llarp_udp_io* udp, const sockaddr* to, const byte_t* ptr, size_t sz)
{ {
udp_glue* self = static_cast< udp_glue* >(udp->impl); auto* self = static_cast< udp_glue* >(udp->impl);
if(self == nullptr) if(self == nullptr)
return -1; return -1;
uv_buf_t buf = uv_buf_init((char*)ptr, sz); uv_buf_t buf = uv_buf_init((char*)ptr, sz);
@ -410,7 +410,7 @@ namespace libuv
static void static void
OnClosed(uv_handle_t* h) OnClosed(uv_handle_t* h)
{ {
udp_glue* glue = static_cast< udp_glue* >(h->data); auto* glue = static_cast< udp_glue* >(h->data);
if(glue) if(glue)
{ {
h->data = nullptr; h->data = nullptr;
@ -443,7 +443,7 @@ namespace libuv
readpkt = false; readpkt = false;
} }
~tun_glue() ~tun_glue() override
{ {
tuntap_destroy(m_Device); tuntap_destroy(m_Device);
} }
@ -488,7 +488,7 @@ namespace libuv
static void static void
OnClosed(uv_handle_t* h) OnClosed(uv_handle_t* h)
{ {
tun_glue* self = static_cast< tun_glue* >(h->data); auto* self = static_cast< tun_glue* >(h->data);
if(self) if(self)
{ {
self->m_Tun->impl = nullptr; self->m_Tun->impl = nullptr;
@ -597,8 +597,8 @@ namespace libuv
bool bool
Loop::tcp_connect(llarp_tcp_connecter* tcp, const sockaddr* addr) Loop::tcp_connect(llarp_tcp_connecter* tcp, const sockaddr* addr)
{ {
conn_glue* impl = new conn_glue(m_Impl.get(), tcp, addr); auto* impl = new conn_glue(m_Impl.get(), tcp, addr);
tcp->impl = impl; tcp->impl = impl;
if(impl->ConnectAsync()) if(impl->ConnectAsync())
return true; return true;
delete impl; delete impl;
@ -656,8 +656,8 @@ namespace libuv
bool bool
Loop::udp_listen(llarp_udp_io* udp, const sockaddr* src) Loop::udp_listen(llarp_udp_io* udp, const sockaddr* src)
{ {
udp_glue* impl = new udp_glue(m_Impl.get(), udp, src); auto* impl = new udp_glue(m_Impl.get(), udp, src);
udp->impl = impl; udp->impl = impl;
if(impl->Bind()) if(impl->Bind())
{ {
return true; return true;
@ -671,7 +671,7 @@ namespace libuv
{ {
if(udp == nullptr) if(udp == nullptr)
return false; return false;
udp_glue* glue = static_cast< udp_glue* >(udp->impl); auto* glue = static_cast< udp_glue* >(udp->impl);
if(glue == nullptr) if(glue == nullptr)
return false; return false;
glue->Close(); glue->Close();
@ -681,8 +681,8 @@ namespace libuv
bool bool
Loop::tun_listen(llarp_tun_io* tun) Loop::tun_listen(llarp_tun_io* tun)
{ {
tun_glue* glue = new tun_glue(tun); auto* glue = new tun_glue(tun);
tun->impl = glue; tun->impl = glue;
if(glue->Init(m_Impl.get())) if(glue->Init(m_Impl.get()))
{ {
return true; return true;
@ -694,8 +694,8 @@ namespace libuv
bool bool
Loop::tcp_listen(llarp_tcp_acceptor* tcp, const sockaddr* addr) Loop::tcp_listen(llarp_tcp_acceptor* tcp, const sockaddr* addr)
{ {
conn_glue* glue = new conn_glue(m_Impl.get(), tcp, addr); auto* glue = new conn_glue(m_Impl.get(), tcp, addr);
tcp->impl = glue; tcp->impl = glue;
if(glue->Server()) if(glue->Server())
return true; return true;
tcp->impl = nullptr; tcp->impl = nullptr;

@ -1,4 +1,5 @@
#include <ev/pipe.hpp> #include <ev/pipe.hpp>
#include <utility>
#ifndef _MSC_VER #ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
@ -6,7 +7,7 @@
#include <fcntl.h> #include <fcntl.h>
llarp_ev_pkt_pipe::llarp_ev_pkt_pipe(llarp_ev_loop_ptr loop) llarp_ev_pkt_pipe::llarp_ev_pkt_pipe(llarp_ev_loop_ptr loop)
: llarp::ev_io(-1, new LosslessWriteQueue_t()), m_Loop(loop) : llarp::ev_io(-1, new LosslessWriteQueue_t()), m_Loop(std::move(loop))
{ {
} }

@ -25,7 +25,7 @@ struct llarp_ev_pkt_pipe : public llarp::ev_io
ssize_t ssize_t
do_write(void* buf, size_t sz) override; do_write(void* buf, size_t sz) override;
virtual bool bool
tick() override; tick() override;
int int

@ -1,4 +1,5 @@
#include <exit/context.hpp> #include <exit/context.hpp>
#include <memory>
namespace llarp namespace llarp
{ {
@ -7,9 +8,7 @@ namespace llarp
Context::Context(AbstractRouter* r) : m_Router(r) Context::Context(AbstractRouter* r) : m_Router(r)
{ {
} }
Context::~Context() Context::~Context() = default;
{
}
void void
Context::Tick(llarp_time_t now) Context::Tick(llarp_time_t now)
@ -112,7 +111,7 @@ namespace llarp
} }
std::unique_ptr< handlers::ExitEndpoint > endpoint; std::unique_ptr< handlers::ExitEndpoint > endpoint;
// make new endpoint // make new endpoint
endpoint.reset(new handlers::ExitEndpoint(name, m_Router)); endpoint = std::make_unique< handlers::ExitEndpoint >(name, m_Router);
// configure // configure
{ {
auto itr = conf.begin(); auto itr = conf.begin();

@ -14,20 +14,18 @@ namespace llarp
struct ObtainExitMessage final : public IMessage struct ObtainExitMessage final : public IMessage
{ {
std::vector< llarp::exit::Policy > B; std::vector< llarp::exit::Policy > B;
uint64_t E; uint64_t E{0};
llarp::PubKey I; llarp::PubKey I;
uint64_t T; uint64_t T{0};
std::vector< llarp::exit::Policy > W; std::vector< llarp::exit::Policy > W;
llarp_time_t X; llarp_time_t X{0};
llarp::Signature Z; llarp::Signature Z;
ObtainExitMessage() : IMessage(), E(0), T(0), X(0) ObtainExitMessage() : IMessage()
{ {
} }
~ObtainExitMessage() ~ObtainExitMessage() override = default;
{
}
void void
Clear() override Clear() override
@ -132,7 +130,7 @@ namespace llarp
Nonce_t Y; Nonce_t Y;
llarp::Signature Z; llarp::Signature Z;
~UpdateExitVerifyMessage() = default; ~UpdateExitVerifyMessage() override = default;
void void
Clear() override Clear() override

@ -6,6 +6,7 @@
#include <path/path.hpp> #include <path/path.hpp>
#include <router/abstractrouter.hpp> #include <router/abstractrouter.hpp>
#include <util/memfn.hpp> #include <util/memfn.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -17,7 +18,7 @@ namespace llarp
AbstractRouter* r, size_t numpaths, size_t hoplen, bool bundleRC) AbstractRouter* r, size_t numpaths, size_t hoplen, bool bundleRC)
: llarp::path::Builder(r, numpaths, hoplen) : llarp::path::Builder(r, numpaths, hoplen)
, m_ExitRouter(routerId) , m_ExitRouter(routerId)
, m_WritePacket(writepkt) , m_WritePacket(std::move(writepkt))
, m_Counter(0) , m_Counter(0)
, m_LastUse(0) , m_LastUse(0)
, m_BundleRC(bundleRC) , m_BundleRC(bundleRC)
@ -25,9 +26,7 @@ namespace llarp
CryptoManager::instance()->identity_keygen(m_ExitIdentity); CryptoManager::instance()->identity_keygen(m_ExitIdentity);
} }
BaseSession::~BaseSession() BaseSession::~BaseSession() = default;
{
}
void void
BaseSession::HandlePathDied(path::Path_ptr p) BaseSession::HandlePathDied(path::Path_ptr p)

@ -31,7 +31,7 @@ namespace llarp
AbstractRouter* r, size_t numpaths, size_t hoplen, AbstractRouter* r, size_t numpaths, size_t hoplen,
bool bundleRC); bool bundleRC);
virtual ~BaseSession(); ~BaseSession() override;
std::shared_ptr< path::PathSet > std::shared_ptr< path::PathSet >
GetSelf() override GetSelf() override
@ -51,7 +51,7 @@ namespace llarp
return m_BundleRC; return m_BundleRC;
} }
virtual void void
ResetInternalState() override; ResetInternalState() override;
bool UrgentBuild(llarp_time_t) const override; bool UrgentBuild(llarp_time_t) const override;
@ -175,13 +175,13 @@ namespace llarp
{ {
} }
~ExitSession() = default; ~ExitSession() override = default;
std::string std::string
Name() const override; Name() const override;
protected: protected:
virtual void void
PopulateRequest(llarp::routing::ObtainExitMessage& msg) const override PopulateRequest(llarp::routing::ObtainExitMessage& msg) const override
{ {
// TODO: set expiration time // TODO: set expiration time
@ -197,7 +197,7 @@ namespace llarp
AbstractRouter* r, size_t numpaths, size_t hoplen, AbstractRouter* r, size_t numpaths, size_t hoplen,
bool useRouterSNodeKey, bool bundleRC); bool useRouterSNodeKey, bool bundleRC);
~SNodeSession() = default; ~SNodeSession() override = default;
std::string std::string
Name() const override; Name() const override;

@ -29,7 +29,8 @@ namespace llarp
, m_Resolver(std::make_shared< dns::Proxy >( , m_Resolver(std::make_shared< dns::Proxy >(
r->netloop(), r->logic(), r->netloop(), r->logic(), this)) r->netloop(), r->logic(), r->netloop(), r->logic(), this))
, m_Name(name) , m_Name(name)
, m_Tun{{0}, 0, {0}, 0, 0, 0, 0, 0, 0, 0, 0} , m_Tun{{0}, 0, {0}, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr}
, m_LocalResolverAddr("127.0.0.1", 53) , m_LocalResolverAddr("127.0.0.1", 53)
, m_InetToNetwork(name + "_exit_rx", r->netloop(), r->netloop()) , m_InetToNetwork(name + "_exit_rx", r->netloop(), r->netloop())
@ -40,9 +41,7 @@ namespace llarp
m_ShouldInitTun = true; m_ShouldInitTun = true;
} }
ExitEndpoint::~ExitEndpoint() ExitEndpoint::~ExitEndpoint() = default;
{
}
util::StatusObject util::StatusObject
ExitEndpoint::ExtractStatus() const ExitEndpoint::ExtractStatus() const

@ -14,7 +14,7 @@ namespace llarp
struct ExitEndpoint : public dns::IQueryHandler struct ExitEndpoint : public dns::IQueryHandler
{ {
ExitEndpoint(const std::string& name, AbstractRouter* r); ExitEndpoint(const std::string& name, AbstractRouter* r);
~ExitEndpoint(); ~ExitEndpoint() override;
void void
Tick(llarp_time_t now); Tick(llarp_time_t now);

@ -31,7 +31,7 @@ namespace llarp
static void static void
tunifTick(llarp_tun_io *tun) tunifTick(llarp_tun_io *tun)
{ {
TunEndpoint *self = static_cast< TunEndpoint * >(tun->user); auto *self = static_cast< TunEndpoint * >(tun->user);
self->Flush(); self->Flush();
} }
@ -412,7 +412,7 @@ namespace llarp
} }
else else
{ {
dns::Message *replyMsg = new dns::Message(std::move(msg)); auto *replyMsg = new dns::Message(std::move(msg));
using service::Address; using service::Address;
using service::OutboundContext; using service::OutboundContext;
return EnsurePathToService( return EnsurePathToService(
@ -432,7 +432,7 @@ namespace llarp
} }
else else
{ {
dns::Message *replyMsg = new dns::Message(std::move(msg)); auto *replyMsg = new dns::Message(std::move(msg));
EnsurePathToSNode(addr.as_array(), EnsurePathToSNode(addr.as_array(),
[=](const RouterID &, exit::BaseSession_ptr s) { [=](const RouterID &, exit::BaseSession_ptr s) {
SendDNSReply(addr, s, replyMsg, reply, true, SendDNSReply(addr, s, replyMsg, reply, true,
@ -577,7 +577,7 @@ namespace llarp
return false; return false;
} }
struct addrinfo hint, *res = NULL; struct addrinfo hint, *res = nullptr;
int ret; int ret;
memset(&hint, 0, sizeof hint); memset(&hint, 0, sizeof hint);
@ -585,7 +585,7 @@ namespace llarp
hint.ai_family = PF_UNSPEC; hint.ai_family = PF_UNSPEC;
hint.ai_flags = AI_NUMERICHOST; hint.ai_flags = AI_NUMERICHOST;
ret = getaddrinfo(tunif.ifaddr, NULL, &hint, &res); ret = getaddrinfo(tunif.ifaddr, nullptr, &hint, &res);
if(ret) if(ret)
{ {
llarp::LogError(Name(), llarp::LogError(Name(),
@ -909,7 +909,7 @@ namespace llarp
TunEndpoint::tunifBeforeWrite(llarp_tun_io *tun) TunEndpoint::tunifBeforeWrite(llarp_tun_io *tun)
{ {
// called in the isolated network thread // called in the isolated network thread
TunEndpoint *self = static_cast< TunEndpoint * >(tun->user); auto *self = static_cast< TunEndpoint * >(tun->user);
// flush user to network // flush user to network
self->FlushSend(); self->FlushSend();
// flush exit traffic queues if it's there // flush exit traffic queues if it's there
@ -928,15 +928,13 @@ namespace llarp
TunEndpoint::tunifRecvPkt(llarp_tun_io *tun, const llarp_buffer_t &b) TunEndpoint::tunifRecvPkt(llarp_tun_io *tun, const llarp_buffer_t &b)
{ {
// called for every packet read from user in isolated network thread // called for every packet read from user in isolated network thread
TunEndpoint *self = static_cast< TunEndpoint * >(tun->user); auto *self = static_cast< TunEndpoint * >(tun->user);
const ManagedBuffer buf(b); const ManagedBuffer buf(b);
self->m_UserToNetworkPktQueue.EmplaceIf( self->m_UserToNetworkPktQueue.EmplaceIf(
[&buf](net::IPPacket &pkt) -> bool { return pkt.Load(buf); }); [&buf](net::IPPacket &pkt) -> bool { return pkt.Load(buf); });
} }
TunEndpoint::~TunEndpoint() TunEndpoint::~TunEndpoint() = default;
{
}
} // namespace handlers } // namespace handlers
} // namespace llarp } // namespace llarp

@ -21,7 +21,7 @@ namespace llarp
{ {
TunEndpoint(const std::string& nickname, AbstractRouter* r, TunEndpoint(const std::string& nickname, AbstractRouter* r,
llarp::service::Context* parent); llarp::service::Context* parent);
~TunEndpoint(); ~TunEndpoint() override;
path::PathSet_ptr path::PathSet_ptr
GetSelf() override GetSelf() override
@ -29,10 +29,10 @@ namespace llarp
return shared_from_this(); return shared_from_this();
} }
virtual bool bool
SetOption(const std::string& k, const std::string& v) override; SetOption(const std::string& k, const std::string& v) override;
virtual void void
Tick(llarp_time_t now) override; Tick(llarp_time_t now) override;
util::StatusObject util::StatusObject
@ -165,7 +165,7 @@ namespace llarp
void void
Flush(); Flush();
virtual void void
ResetInternalState() override; ResetInternalState() override;
protected: protected:

@ -26,9 +26,7 @@ namespace llarp
using Backend_ptr = std::shared_ptr< IBackend >; using Backend_ptr = std::shared_ptr< IBackend >;
inline IBackend::~IBackend() inline IBackend::~IBackend() = default;
{
}
} // namespace hooks } // namespace hooks
} // namespace llarp } // namespace llarp

@ -13,9 +13,7 @@ namespace llarp
m_FlowCookie.Randomize(); m_FlowCookie.Randomize();
} }
LinkLayer::~LinkLayer() LinkLayer::~LinkLayer() = default;
{
}
void void
LinkLayer::Pump() LinkLayer::Pump()

@ -19,7 +19,7 @@ namespace llarp
SessionRenegotiateHandler reneg, SignBufferFunc sign, SessionRenegotiateHandler reneg, SignBufferFunc sign,
TimeoutHandler timeout, SessionClosedHandler closed); TimeoutHandler timeout, SessionClosedHandler closed);
~LinkLayer(); ~LinkLayer() override;
bool bool
Start(std::shared_ptr< Logic > l) override; Start(std::shared_ptr< Logic > l) override;

@ -1,4 +1,5 @@
#include <iwp/outermessage.hpp> #include <iwp/outermessage.hpp>
#include <memory>
namespace llarp namespace llarp
{ {
@ -15,9 +16,7 @@ namespace llarp
Clear(); Clear();
} }
OuterMessage::~OuterMessage() OuterMessage::~OuterMessage() = default;
{
}
void void
OuterMessage::Clear() OuterMessage::Clear()
@ -131,7 +130,7 @@ namespace llarp
return false; return false;
if(buf->size_left() == Zsig.size() + 32) if(buf->size_left() == Zsig.size() + 32)
{ {
A.reset(new AlignedBuffer< 32 >()); A = std::make_unique< AlignedBuffer< 32 > >();
if(!buf->read_into(A->begin(), A->end())) if(!buf->read_into(A->begin(), A->end()))
return false; return false;
} }

@ -18,7 +18,7 @@ namespace llarp
struct LinkManager final : public ILinkManager struct LinkManager final : public ILinkManager
{ {
public: public:
~LinkManager() = default; ~LinkManager() override = default;
LinkLayer_ptr LinkLayer_ptr
GetCompatibleLink(const RouterContact &rc) const override; GetCompatibleLink(const RouterContact &rc) const override;
@ -71,7 +71,7 @@ namespace llarp
void void
CheckPersistingSessions(llarp_time_t now) override; CheckPersistingSessions(llarp_time_t now) override;
virtual util::StatusObject util::StatusObject
ExtractStatus() const override; ExtractStatus() const override;
void void

@ -2,6 +2,7 @@
#include <crypto/crypto.hpp> #include <crypto/crypto.hpp>
#include <util/fs.hpp> #include <util/fs.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -12,20 +13,18 @@ namespace llarp
SessionEstablishedHandler establishedSession, SessionEstablishedHandler establishedSession,
SessionRenegotiateHandler reneg, SessionRenegotiateHandler reneg,
TimeoutHandler timeout, SessionClosedHandler closed) TimeoutHandler timeout, SessionClosedHandler closed)
: HandleMessage(handler) : HandleMessage(std::move(handler))
, HandleTimeout(timeout) , HandleTimeout(std::move(timeout))
, Sign(signbuf) , Sign(std::move(signbuf))
, GetOurRC(getrc) , GetOurRC(std::move(getrc))
, SessionEstablished(establishedSession) , SessionEstablished(std::move(establishedSession))
, SessionClosed(closed) , SessionClosed(std::move(closed))
, SessionRenegotiate(reneg) , SessionRenegotiate(std::move(reneg))
, m_RouterEncSecret(routerEncSecret) , m_RouterEncSecret(routerEncSecret)
{ {
} }
ILinkLayer::~ILinkLayer() ILinkLayer::~ILinkLayer() = default;
{
}
bool bool
ILinkLayer::HasSessionTo(const RouterID& id) ILinkLayer::HasSessionTo(const RouterID& id)

@ -16,9 +16,7 @@ namespace llarp
struct ILinkSession struct ILinkSession
{ {
virtual ~ILinkSession() virtual ~ILinkSession() = default;
{
}
/// delivery status of a message /// delivery status of a message
enum class DeliveryStatus enum class DeliveryStatus

@ -10,8 +10,8 @@ namespace llarp
{ {
struct DHTImmediateMessage final : public ILinkMessage struct DHTImmediateMessage final : public ILinkMessage
{ {
DHTImmediateMessage() = default; DHTImmediateMessage() = default;
~DHTImmediateMessage() = default; ~DHTImmediateMessage() override = default;
std::vector< std::unique_ptr< dht::IMessage > > msgs; std::vector< std::unique_ptr< dht::IMessage > > msgs;

@ -31,7 +31,7 @@ namespace llarp
{ {
return bencode_read_integer(buf, &P); return bencode_read_integer(buf, &P);
} }
else if(key == "r") if(key == "r")
{ {
if(rc.BDecode(buf)) if(rc.BDecode(buf))
return true; return true;
@ -39,7 +39,7 @@ namespace llarp
llarp::DumpBuffer(*buf); llarp::DumpBuffer(*buf);
return false; return false;
} }
else if(key == "v") if(key == "v")
{ {
if(!bencode_read_integer(buf, &version)) if(!bencode_read_integer(buf, &version))
return false; return false;
@ -52,15 +52,13 @@ namespace llarp
llarp::LogDebug("LIM version ", version); llarp::LogDebug("LIM version ", version);
return true; return true;
} }
else if(key == "z") if(key == "z")
{ {
return Z.BDecode(buf); return Z.BDecode(buf);
} }
else
{ llarp::LogWarn("invalid LIM key: ", *key.cur);
llarp::LogWarn("invalid LIM key: ", *key.cur); return false;
return false;
}
} }
bool bool

@ -37,9 +37,7 @@ namespace llarp
{ {
} }
LinkMessageParser::~LinkMessageParser() LinkMessageParser::~LinkMessageParser() = default;
{
}
bool bool
LinkMessageParser::operator()(llarp_buffer_t* buffer, llarp_buffer_t* key) LinkMessageParser::operator()(llarp_buffer_t* buffer, llarp_buffer_t* key)

@ -171,9 +171,9 @@ namespace llarp
struct LRCMFrameDecrypt struct LRCMFrameDecrypt
{ {
typedef llarp::path::PathContext Context; using Context = llarp::path::PathContext;
typedef llarp::path::TransitHop Hop; using Hop = llarp::path::TransitHop;
typedef AsyncFrameDecrypter< LRCMFrameDecrypt > Decrypter; using Decrypter = AsyncFrameDecrypter< LRCMFrameDecrypt >;
using Decrypter_ptr = std::unique_ptr< Decrypter >; using Decrypter_ptr = std::unique_ptr< Decrypter >;
Decrypter_ptr decrypter; Decrypter_ptr decrypter;
std::array< EncryptedFrame, 8 > frames; std::array< EncryptedFrame, 8 > frames;
@ -193,9 +193,7 @@ namespace llarp
hop->info.downstream = commit->session->GetPubKey(); hop->info.downstream = commit->session->GetPubKey();
} }
~LRCMFrameDecrypt() ~LRCMFrameDecrypt() = default;
{
}
static void static void
OnForwardLRCMResult(AbstractRouter* router, const PathID_t pathid, OnForwardLRCMResult(AbstractRouter* router, const PathID_t pathid,

@ -9,6 +9,7 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <utility>
namespace llarp namespace llarp
{ {
@ -49,14 +50,14 @@ namespace llarp
{ {
std::array< EncryptedFrame, 8 > frames; std::array< EncryptedFrame, 8 > frames;
LR_CommitMessage(const std::array< EncryptedFrame, 8 > &_frames) LR_CommitMessage(std::array< EncryptedFrame, 8 > _frames)
: ILinkMessage(), frames(_frames) : ILinkMessage(), frames(std::move(_frames))
{ {
} }
LR_CommitMessage() = default; LR_CommitMessage() = default;
~LR_CommitMessage() = default; ~LR_CommitMessage() override = default;
void void
Clear() override; Clear() override;

@ -12,6 +12,7 @@
#include <util/memfn.hpp> #include <util/memfn.hpp>
#include <functional> #include <functional>
#include <utility>
namespace llarp namespace llarp
{ {
@ -25,10 +26,12 @@ namespace llarp
HopHandler_ptr path; HopHandler_ptr path;
AbstractRouter* router; AbstractRouter* router;
LRSM_AsyncHandler(const std::array< EncryptedFrame, 8 >& _frames, LRSM_AsyncHandler(std::array< EncryptedFrame, 8 > _frames, uint64_t _status,
uint64_t _status, HopHandler_ptr _path, HopHandler_ptr _path, AbstractRouter* _router)
AbstractRouter* _router) : frames(std::move(_frames))
: frames(_frames), status(_status), path(_path), router(_router) , status(_status)
, path(std::move(_path))
, router(_router)
{ {
} }
@ -57,7 +60,7 @@ namespace llarp
{ {
return BEncodeReadArray(frames, buf); return BEncodeReadArray(frames, buf);
} }
else if(key == "p") if(key == "p")
{ {
if(!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf)) if(!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf))
{ {

@ -9,6 +9,7 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <utility>
namespace llarp namespace llarp
{ {
@ -56,14 +57,14 @@ namespace llarp
uint64_t status = 0; uint64_t status = 0;
LR_StatusMessage(const std::array< EncryptedFrame, 8 > &_frames) LR_StatusMessage(std::array< EncryptedFrame, 8 > _frames)
: ILinkMessage(), frames(_frames) : ILinkMessage(), frames(std::move(_frames))
{ {
} }
LR_StatusMessage() = default; LR_StatusMessage() = default;
~LR_StatusMessage() = default; ~LR_StatusMessage() override = default;
void void
Clear() override; Clear() override;

@ -8,6 +8,7 @@
#include <functional> #include <functional>
#include <iosfwd> #include <iosfwd>
#include <utility>
namespace llarp namespace llarp
{ {
@ -22,13 +23,11 @@ namespace llarp
PublishFunction m_publish; PublishFunction m_publish;
public: public:
JsonPublisher(const PublishFunction& publish) : m_publish(publish) JsonPublisher(PublishFunction publish) : m_publish(std::move(publish))
{ {
} }
~JsonPublisher() ~JsonPublisher() override = default;
{
}
void void
publish(const Sample& values) override; publish(const Sample& values) override;

@ -9,6 +9,7 @@
#include <string> #include <string>
#include <thread> #include <thread>
#include <tuple> #include <tuple>
#include <utility>
#include <vector> #include <vector>
namespace llarp namespace llarp
@ -32,9 +33,7 @@ namespace llarp
{ {
} }
~MetricTankPublisherInterface() ~MetricTankPublisherInterface() override = default;
{
}
static std::string static std::string
makeSuffix(const Tags& tags); makeSuffix(const Tags& tags);
@ -66,16 +65,16 @@ namespace llarp
work(); work();
public: public:
MetricTankPublisher(const Tags& tags, const std::string& host, short port) MetricTankPublisher(const Tags& tags, std::string host, short port)
: MetricTankPublisherInterface(tags) : MetricTankPublisherInterface(tags)
, m_host(host) , m_host(std::move(host))
, m_port(port) , m_port(port)
, m_queue(100) , m_queue(100)
, m_worker(&MetricTankPublisher::work, this) , m_worker(&MetricTankPublisher::work, this)
{ {
} }
~MetricTankPublisher() ~MetricTankPublisher() override
{ {
// Push back a signal value onto the queue // Push back a signal value onto the queue
m_queue.pushBack(StopStruct()); m_queue.pushBack(StopStruct());

@ -18,7 +18,7 @@ namespace llarp
{ {
} }
~StreamPublisher() = default; ~StreamPublisher() override = default;
void void
publish(const Sample& values) override; publish(const Sample& values) override;

@ -8,7 +8,7 @@
#include <util/mem.h> #include <util/mem.h>
#include <util/printer.hpp> #include <util/printer.hpp>
#include <string.h> #include <cstring>
namespace llarp namespace llarp
{ {

@ -8,7 +8,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdbool.h>
/** /**
* address_info.hpp * address_info.hpp

@ -8,7 +8,7 @@
#include <util/mem.h> #include <util/mem.h>
#include <list> #include <list>
#include <string.h> #include <cstring>
namespace llarp namespace llarp
{ {

@ -23,9 +23,7 @@ namespace llarp
PubKey pubkey; PubKey pubkey;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = LLARP_PROTO_VERSION;
ExitInfo() ExitInfo() = default;
{
}
ExitInfo(const PubKey &pk, const nuint32_t &ipv4_exit) : pubkey(pk) ExitInfo(const PubKey &pk, const nuint32_t &ipv4_exit) : pubkey(pk)
{ {

@ -71,8 +71,8 @@ namespace llarp
{ {
if(IsV6()) if(IsV6())
return In6ToHUInt(HeaderV6()->srcaddr); return In6ToHUInt(HeaderV6()->srcaddr);
else
return ExpandV4(srcv4()); return ExpandV4(srcv4());
} }
huint128_t huint128_t
@ -80,8 +80,8 @@ namespace llarp
{ {
if(IsV6()) if(IsV6())
return In6ToHUInt(HeaderV6()->dstaddr); return In6ToHUInt(HeaderV6()->dstaddr);
else
return ExpandV4(dstv4()); return ExpandV4(dstv4());
} }
bool bool

@ -88,6 +88,7 @@ struct ipv6_header
#include <memory> #include <memory>
#include <service/protocol.hpp> #include <service/protocol.hpp>
#include <utility>
struct llarp_ev_loop; struct llarp_ev_loop;
@ -136,7 +137,7 @@ namespace llarp
struct PutTime struct PutTime
{ {
llarp_ev_loop_ptr loop; llarp_ev_loop_ptr loop;
PutTime(llarp_ev_loop_ptr evloop) : loop(evloop) PutTime(llarp_ev_loop_ptr evloop) : loop(std::move(evloop))
{ {
} }
void void
@ -149,7 +150,7 @@ namespace llarp
struct GetNow struct GetNow
{ {
llarp_ev_loop_ptr loop; llarp_ev_loop_ptr loop;
GetNow(llarp_ev_loop_ptr evloop) : loop(evloop) GetNow(llarp_ev_loop_ptr evloop) : loop(std::move(evloop))
{ {
} }
llarp_time_t llarp_time_t
@ -224,10 +225,10 @@ namespace llarp
{ {
if(IsV4()) if(IsV4())
return service::eProtocolTrafficV4; return service::eProtocolTrafficV4;
else if(IsV6()) if(IsV6())
return service::eProtocolTrafficV6; return service::eProtocolTrafficV6;
else
return service::eProtocolControl; return service::eProtocolControl;
} }
huint128_t huint128_t

@ -786,7 +786,7 @@ llarp_getifaddr(const char* ifname, int af, struct sockaddr* addr)
if(af == AF_INET6) if(af == AF_INET6)
{ {
// set scope id // set scope id
sockaddr_in6* ip6addr = (sockaddr_in6*)addr; auto* ip6addr = (sockaddr_in6*)addr;
ip6addr->sin6_scope_id = if_nametoindex(ifname); ip6addr->sin6_scope_id = if_nametoindex(ifname);
ip6addr->sin6_flowinfo = 0; ip6addr->sin6_flowinfo = 0;
} }
@ -861,8 +861,8 @@ namespace llarp
const auto fam = i->ifa_addr->sa_family; const auto fam = i->ifa_addr->sa_family;
if(fam != AF_INET) if(fam != AF_INET)
return; return;
sockaddr_in* addr = (sockaddr_in*)i->ifa_addr; auto* addr = (sockaddr_in*)i->ifa_addr;
sockaddr_in* mask = (sockaddr_in*)i->ifa_netmask; auto* mask = (sockaddr_in*)i->ifa_netmask;
nuint32_t ifaddr{addr->sin_addr.s_addr}; nuint32_t ifaddr{addr->sin_addr.s_addr};
nuint32_t ifmask{mask->sin_addr.s_addr}; nuint32_t ifmask{mask->sin_addr.s_addr};
currentRanges.emplace_back( currentRanges.emplace_back(
@ -926,7 +926,7 @@ namespace llarp
GetIFAddr(const std::string& ifname, Addr& addr, int af) GetIFAddr(const std::string& ifname, Addr& addr, int af)
{ {
sockaddr_storage s; sockaddr_storage s;
sockaddr* sptr = (sockaddr*)&s; auto* sptr = (sockaddr*)&s;
if(!llarp_getifaddr(ifname.c_str(), af, sptr)) if(!llarp_getifaddr(ifname.c_str(), af, sptr))
return false; return false;
addr = *sptr; addr = *sptr;

@ -25,7 +25,7 @@ typedef unsigned int in_addr_t;
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#include <stdbool.h>
#include <sys/types.h> #include <sys/types.h>
bool bool

@ -11,7 +11,7 @@
#include <util/bits.hpp> #include <util/bits.hpp>
#include <functional> #include <functional>
#include <stdlib.h> // for itoa #include <cstdlib> // for itoa
#include <vector> #include <vector>
// for addrinfo // for addrinfo

@ -16,12 +16,8 @@
namespace llarp namespace llarp
{ {
Addr::Addr() Addr::Addr() = default;
{ Addr::~Addr() = default;
}
Addr::~Addr()
{
}
void void
Addr::port(uint16_t port) Addr::port(uint16_t port)
@ -87,7 +83,7 @@ namespace llarp
this->port(port); this->port(port);
} }
Zero(&_addr, sizeof(sockaddr_in6)); Zero(&_addr, sizeof(sockaddr_in6));
struct addrinfo hint, *res = NULL; struct addrinfo hint, *res = nullptr;
int ret; int ret;
memset(&hint, '\0', sizeof hint); memset(&hint, '\0', sizeof hint);
@ -98,11 +94,11 @@ namespace llarp
if(pPosition != string_view::npos) if(pPosition != string_view::npos)
{ {
ret = getaddrinfo(std::string(in.begin(), in.begin() + pPosition).c_str(), ret = getaddrinfo(std::string(in.begin(), in.begin() + pPosition).c_str(),
NULL, &hint, &res); nullptr, &hint, &res);
} }
else else
{ {
ret = getaddrinfo(std::string(in).c_str(), NULL, &hint, &res); ret = getaddrinfo(std::string(in).c_str(), nullptr, &hint, &res);
} }
if(ret) if(ret)
@ -152,7 +148,7 @@ namespace llarp
{ {
Zero(&_addr, sizeof(sockaddr_in6)); Zero(&_addr, sizeof(sockaddr_in6));
struct in_addr* addr = &_addr4.sin_addr; struct in_addr* addr = &_addr4.sin_addr;
unsigned char* ip = (unsigned char*)&(addr->s_addr); auto* ip = (unsigned char*)&(addr->s_addr);
_addr.sin6_family = AF_INET; // set ipv4 mode _addr.sin6_family = AF_INET; // set ipv4 mode
_addr4.sin_family = AF_INET; _addr4.sin_family = AF_INET;
@ -311,11 +307,11 @@ namespace llarp
{ {
case AF_INET: case AF_INET:
{ {
sockaddr_in* ipv4_dst = (sockaddr_in*)other; auto* ipv4_dst = (sockaddr_in*)other;
dst = (void*)&ipv4_dst->sin_addr.s_addr; dst = (void*)&ipv4_dst->sin_addr.s_addr;
src = (void*)&_addr4.sin_addr.s_addr; src = (void*)&_addr4.sin_addr.s_addr;
ptr = &((sockaddr_in*)other)->sin_port; ptr = &((sockaddr_in*)other)->sin_port;
slen = sizeof(in_addr); slen = sizeof(in_addr);
break; break;
} }
case AF_INET6: case AF_INET6:

@ -32,7 +32,7 @@ namespace llarp
this->reset(); this->reset();
// maybe refactor the family detection out // maybe refactor the family detection out
struct addrinfo hint, *res = NULL; struct addrinfo hint, *res = nullptr;
int ret; int ret;
memset(&hint, '\0', sizeof hint); memset(&hint, '\0', sizeof hint);
@ -40,7 +40,7 @@ namespace llarp
hint.ai_family = PF_UNSPEC; hint.ai_family = PF_UNSPEC;
hint.ai_flags = AI_NUMERICHOST; hint.ai_flags = AI_NUMERICHOST;
ret = getaddrinfo(str, NULL, &hint, &res); ret = getaddrinfo(str, nullptr, &hint, &res);
if(ret) if(ret)
{ {
llarp::LogError("failed to determine address family: ", str); llarp::LogError("failed to determine address family: ", str);

@ -14,7 +14,7 @@
#include <net/net.h> #include <net/net.h>
#include <stdlib.h> // for itoa #include <cstdlib> // for itoa
#include <iostream> #include <iostream>
#include <util/endian.hpp> #include <util/endian.hpp>
#include <vector> #include <vector>

@ -12,12 +12,13 @@
#include <fstream> #include <fstream>
#include <unordered_map> #include <unordered_map>
#include <utility>
static const char skiplist_subdirs[] = "0123456789abcdef"; static const char skiplist_subdirs[] = "0123456789abcdef";
static const std::string RC_FILE_EXT = ".signed"; static const std::string RC_FILE_EXT = ".signed";
llarp_nodedb::NetDBEntry::NetDBEntry(const llarp::RouterContact &value) llarp_nodedb::NetDBEntry::NetDBEntry(llarp::RouterContact value)
: rc(value), inserted(llarp::time_now_ms()) : rc(std::move(value)), inserted(llarp::time_now_ms())
{ {
} }
@ -151,7 +152,7 @@ llarp_nodedb::UpdateAsyncIfNewer(llarp::RouterContact rc,
InsertAsync(rc, logic, completionHandler); InsertAsync(rc, logic, completionHandler);
return true; return true;
} }
else if(itr != entries.end()) if(itr != entries.end())
{ {
// insertion time is set on...insertion. But it should be updated here // insertion time is set on...insertion. But it should be updated here
// even if there is no insertion of a new RC, to show that the existing one // even if there is no insertion of a new RC, to show that the existing one
@ -362,8 +363,7 @@ llarp_nodedb::Save()
void void
logic_threadworker_callback(void *user) logic_threadworker_callback(void *user)
{ {
llarp_async_verify_rc *verify_request = auto *verify_request = static_cast< llarp_async_verify_rc * >(user);
static_cast< llarp_async_verify_rc * >(user);
if(verify_request->hook) if(verify_request->hook)
verify_request->hook(verify_request); verify_request->hook(verify_request);
} }
@ -382,8 +382,7 @@ disk_threadworker_setRC(llarp_async_verify_rc *verify_request)
void void
crypto_threadworker_verifyrc(void *user) crypto_threadworker_verifyrc(void *user)
{ {
llarp_async_verify_rc *verify_request = auto *verify_request = static_cast< llarp_async_verify_rc * >(user);
static_cast< llarp_async_verify_rc * >(user);
llarp::RouterContact rc = verify_request->rc; llarp::RouterContact rc = verify_request->rc;
verify_request->valid = rc.Verify(llarp::time_now_ms()); verify_request->valid = rc.Verify(llarp::time_now_ms());
// if it's valid we need to set it // if it's valid we need to set it
@ -404,14 +403,14 @@ crypto_threadworker_verifyrc(void *user)
void void
nodedb_inform_load_rc(void *user) nodedb_inform_load_rc(void *user)
{ {
llarp_async_load_rc *job = static_cast< llarp_async_load_rc * >(user); auto *job = static_cast< llarp_async_load_rc * >(user);
job->hook(job); job->hook(job);
} }
void void
nodedb_async_load_rc(void *user) nodedb_async_load_rc(void *user)
{ {
llarp_async_load_rc *job = static_cast< llarp_async_load_rc * >(user); auto *job = static_cast< llarp_async_load_rc * >(user);
auto fpath = job->nodedb->getRCFilePath(job->pubkey); auto fpath = job->nodedb->getRCFilePath(job->pubkey);
job->loaded = job->nodedb->loadfile(fpath); job->loaded = job->nodedb->loadfile(fpath);

@ -10,6 +10,7 @@
#include <absl/base/thread_annotations.h> #include <absl/base/thread_annotations.h>
#include <set> #include <set>
#include <utility>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <BaseTsd.h> #include <BaseTsd.h>
@ -45,7 +46,7 @@ struct llarp_nodedb_iter
struct llarp_nodedb struct llarp_nodedb
{ {
explicit llarp_nodedb(std::shared_ptr< llarp::thread::ThreadPool > diskworker) explicit llarp_nodedb(std::shared_ptr< llarp::thread::ThreadPool > diskworker)
: disk(diskworker) : disk(std::move(diskworker))
{ {
} }
@ -62,7 +63,7 @@ struct llarp_nodedb
const llarp::RouterContact rc; const llarp::RouterContact rc;
llarp_time_t inserted; llarp_time_t inserted;
NetDBEntry(const llarp::RouterContact &data); NetDBEntry(llarp::RouterContact data);
}; };
using NetDBMap_t = using NetDBMap_t =

@ -22,9 +22,7 @@ namespace llarp
{ {
struct IHopHandler struct IHopHandler
{ {
virtual ~IHopHandler() virtual ~IHopHandler() = default;
{
}
virtual bool virtual bool
Expired(llarp_time_t now) const = 0; Expired(llarp_time_t now) const = 0;

@ -215,7 +215,7 @@ namespace llarp
m_PathSet->HandlePathBuildFailed(shared_from_this()); m_PathSet->HandlePathBuildFailed(shared_from_this());
return; return;
} }
else if(st == ePathExpired && _status == ePathBuilding) if(st == ePathExpired && _status == ePathBuilding)
{ {
_status = st; _status = st;
m_PathSet->HandlePathBuildTimeout(shared_from_this()); m_PathSet->HandlePathBuildTimeout(shared_from_this());

@ -53,18 +53,18 @@ namespace llarp
util::StatusObject util::StatusObject
ExtractStatus() const; ExtractStatus() const;
virtual bool bool
SelectHop(llarp_nodedb* db, const std::set< RouterID >& prev, SelectHop(llarp_nodedb* db, const std::set< RouterID >& prev,
RouterContact& cur, size_t hop, PathRole roles) override; RouterContact& cur, size_t hop, PathRole roles) override;
virtual bool bool
ShouldBuildMore(llarp_time_t now) const override; ShouldBuildMore(llarp_time_t now) const override;
/// should we bundle RCs in builds? /// should we bundle RCs in builds?
virtual bool virtual bool
ShouldBundleRC() const = 0; ShouldBundleRC() const = 0;
virtual void void
ResetInternalState() override; ResetInternalState() override;
/// return true if we hit our soft limit for building paths too fast /// return true if we hit our soft limit for building paths too fast
@ -78,7 +78,7 @@ namespace llarp
return ePathRoleAny; return ePathRoleAny;
} }
virtual bool bool
Stop() override; Stop() override;
bool bool
@ -90,7 +90,7 @@ namespace llarp
llarp_time_t llarp_time_t
Now() const override; Now() const override;
virtual void void
Tick(llarp_time_t now) override; Tick(llarp_time_t now) override;
void void
@ -113,13 +113,13 @@ namespace llarp
virtual const SecretKey& virtual const SecretKey&
GetTunnelEncryptionSecretKey() const; GetTunnelEncryptionSecretKey() const;
virtual void void
HandlePathBuilt(Path_ptr p) override; HandlePathBuilt(Path_ptr p) override;
virtual void void
HandlePathBuildTimeout(Path_ptr p) override; HandlePathBuildTimeout(Path_ptr p) override;
virtual void void
HandlePathBuildFailed(Path_ptr p) override; HandlePathBuildFailed(Path_ptr p) override;
}; };

@ -31,9 +31,7 @@ namespace llarp
return stream; return stream;
} }
TransitHop::TransitHop() TransitHop::TransitHop() = default;
{
}
bool bool
TransitHop::Expired(llarp_time_t now) const TransitHop::Expired(llarp_time_t now) const

@ -7,9 +7,7 @@
namespace llarp namespace llarp
{ {
PoW::~PoW() PoW::~PoW() = default;
{
}
bool bool
PoW::DecodeKey(ABSL_ATTRIBUTE_UNUSED const llarp_buffer_t& k, PoW::DecodeKey(ABSL_ATTRIBUTE_UNUSED const llarp_buffer_t& k,

@ -22,7 +22,7 @@ namespace llarp
struct OutboundMessageHandler final : public IOutboundMessageHandler struct OutboundMessageHandler final : public IOutboundMessageHandler
{ {
public: public:
~OutboundMessageHandler() = default; ~OutboundMessageHandler() override = default;
bool bool
QueueMessage(const RouterID &remote, const ILinkMessage *msg, QueueMessage(const RouterID &remote, const ILinkMessage *msg,

@ -10,6 +10,7 @@
#include <util/threading.hpp> #include <util/threading.hpp>
#include <util/status.hpp> #include <util/status.hpp>
#include <crypto/crypto.hpp> #include <crypto/crypto.hpp>
#include <utility>
namespace llarp namespace llarp
{ {
@ -22,8 +23,8 @@ namespace llarp
size_t attemptCount = 0; size_t attemptCount = 0;
PendingSession(const RouterContact &_rc, LinkLayer_ptr _link) PendingSession(RouterContact _rc, LinkLayer_ptr _link)
: rc(_rc), link(_link) : rc(std::move(_rc)), link(std::move(_link))
{ {
} }
}; };

@ -26,7 +26,7 @@ namespace llarp
using CallbacksQueue = std::list< RouterCallback >; using CallbacksQueue = std::list< RouterCallback >;
public: public:
~OutboundSessionMaker() = default; ~OutboundSessionMaker() override = default;
bool bool
OnSessionEstablished(ILinkSession *session) override; OnSessionEstablished(ILinkSession *session) override;

@ -28,7 +28,7 @@ namespace llarp
public: public:
using CallbacksQueue = std::list< RCRequestCallback >; using CallbacksQueue = std::list< RCRequestCallback >;
~RCLookupHandler() = default; ~RCLookupHandler() override = default;
void void
AddValidRouter(const RouterID &router) override LOCKS_EXCLUDED(_mutex); AddValidRouter(const RouterID &router) override LOCKS_EXCLUDED(_mutex);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save