Merge pull request #1382 from loki-project/dev

0.8.0 release for real*
pull/1388/head
Jason Rhinelander 4 years ago committed by GitHub
commit 5a85aa96ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,7 +36,6 @@ namespace llarp
constexpr int DefaultWorkerThreads = 1;
constexpr int DefaultNetThreads = 1;
constexpr bool DefaultBlockBogons = true;
constexpr bool DefaultEnablePeerStats = true;
conf.defineOption<int>("router", "job-queue-size", false, DefaultJobQueueSize, [this](int arg) {
if (arg < 1024)
@ -81,12 +80,29 @@ namespace llarp
m_dataDir = std::move(arg);
});
conf.defineOption<std::string>("router", "public-address", false, "", [this](std::string arg) {
conf.defineOption<std::string>("router", "public-ip", false, "", [this](std::string arg) {
if (not arg.empty())
{
llarp::LogInfo("public ip ", arg, " size ", arg.size());
if (arg.size() > 16)
if (arg.size() > 15)
throw std::invalid_argument(stringify("Not a valid IPv4 addr: ", arg));
m_publicAddress.setAddress(arg);
}
});
conf.defineOption<std::string>("router", "public-address", false, "", [this](std::string arg) {
if (not arg.empty())
{
llarp::LogWarn(
"*** WARNING: The config option [router]:public-address=",
arg,
" is deprecated, use public-ip=",
arg,
" instead.");
if (arg.size() > 15)
throw std::invalid_argument(stringify("Not a valid IPv4 addr: ", arg));
m_publicAddress.setAddress(arg);
@ -134,7 +150,7 @@ namespace llarp
"router",
"enable-peer-stats",
false,
DefaultEnablePeerStats,
params.isRelay,
AssignmentAcceptor(m_enablePeerStats));
m_isRelay = params.isRelay;
}
@ -448,13 +464,10 @@ namespace llarp
void
ApiConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params)
{
(void)params;
constexpr bool DefaultRPCEnabled = true;
constexpr auto DefaultRPCBindAddr = "tcp://127.0.0.1:1190";
conf.defineOption<bool>(
"api", "enabled", false, DefaultRPCEnabled, AssignmentAcceptor(m_enableRPCServer));
"api", "enabled", false, not params.isRelay, AssignmentAcceptor(m_enableRPCServer));
conf.defineOption<std::string>(
"api", "bind", false, DefaultRPCBindAddr, [this](std::string arg) {
@ -478,7 +491,6 @@ namespace llarp
{
(void)params;
constexpr bool DefaultWhitelistRouters = false;
constexpr auto DefaultLokidRPCAddr = "tcp://127.0.0.1:22023";
conf.defineOption<std::string>(
@ -491,7 +503,7 @@ namespace llarp
});
conf.defineOption<bool>(
"lokid", "enabled", false, DefaultWhitelistRouters, AssignmentAcceptor(whitelistRouters));
"lokid", "enabled", false, params.isRelay, AssignmentAcceptor(whitelistRouters));
conf.defineOption<std::string>("lokid", "jsonrpc", false, "", [](std::string arg) {
if (arg.empty())
@ -769,6 +781,23 @@ namespace llarp
"Maximum number (hard limit) of routers lokinet will be connected to at any time.",
});
def.addOptionComments(
"router",
"public-ip",
{
"For complex network configurations where the detected IP is incorrect or non-public",
"this setting specifies the public IP at which this router is reachable. When",
"provided the public-port option must also be specified.",
});
def.addOptionComments(
"router",
"public-port",
{
"When specifying public-ip=, this specifies the public UDP port at which this lokinet",
"router is reachable. Required when public-ip is used.",
});
// logging
def.addSectionComments(
"logging",

@ -18,7 +18,7 @@ namespace llarp
if (m_initialized)
return false;
fs::path root = config.router.m_dataDir;
const fs::path root = config.router.m_dataDir;
// utility function to assign a path, using the specified config parameter if present and
// falling back to root / defaultName if not
@ -31,7 +31,7 @@ namespace llarp
{
fs::path file(option);
if (not file.is_absolute())
throw std::runtime_error(stringify("override for ", defaultName, " cannot be relative"));
file = root / file;
return file;
}

@ -66,7 +66,8 @@ namespace llarp
, m_lokidRpcClient(std::make_shared<rpc::LokidRpcClient>(m_lmq, this))
{
m_keyManager = std::make_shared<KeyManager>();
// for lokid, so we don't close the connection when syncing the whitelist
m_lmq->MAX_MSG_SIZE = -1;
_stopping.store(false);
_running.store(false);
_lastTick = llarp::time_now_ms();
@ -567,8 +568,22 @@ namespace llarp
whitelistRouters,
m_isServiceNode);
std::vector<LinksConfig::LinkInfo> inboundLinks = conf.links.m_InboundLinks;
if (inboundLinks.empty() and m_isServiceNode)
{
const auto& publicAddr = conf.router.m_publicAddress;
if (publicAddr.isEmpty() or not publicAddr.hasPort())
{
throw std::runtime_error(
"service node enabled but could not find a public IP to bind to; you need to set the "
"public-ip= and public-port= options");
}
inboundLinks.push_back(LinksConfig::LinkInfo{"0.0.0.0", AF_INET, *publicAddr.getPort()});
}
// create inbound links, if we are a service node
for (const LinksConfig::LinkInfo& serverConfig : conf.links.m_InboundLinks)
for (const LinksConfig::LinkInfo& serverConfig : inboundLinks)
{
auto server = iwp::NewInboundLink(
m_keyManager,
@ -593,11 +608,6 @@ namespace llarp
_linkManager.AddLink(std::move(server), true);
}
if (conf.links.m_InboundLinks.empty() and m_isServiceNode)
{
throw std::runtime_error("service node enabled but have no inbound links");
}
// Network config
if (conf.network.m_enableProfiling.has_value() and not*conf.network.m_enableProfiling)
{
@ -1118,6 +1128,7 @@ namespace llarp
StopLinks();
nodedb()->AsyncFlushToDisk();
_logic->call_later(200ms, std::bind(&Router::AfterStopLinks, this));
m_lmq.reset();
}
void

@ -235,7 +235,7 @@ namespace llarp
try
{
std::string_view buf_view(reinterpret_cast<char*>(buf->cur), buf->sz);
std::string_view buf_view(reinterpret_cast<char*>(buf->cur), buf->size_left());
lokimq::bt_list_consumer btlist(buf_view);
uint64_t outer_version = btlist.consume_integer<uint64_t>();
@ -266,7 +266,6 @@ namespace llarp
bool
RouterContact::DecodeVersion_0(llarp_buffer_t* buf)
{
signed_bt_dict = std::string(reinterpret_cast<char*>(buf->cur), buf->sz);
return bencode_decode_dict(*this, buf);
}

@ -67,8 +67,9 @@ namespace llarp
void
LokidRpcClient::UpdateServiceNodeList()
{
nlohmann::json request;
request["pubkey_ed25519"] = true;
nlohmann::json request, fields;
fields["pubkey_ed25519"] = true;
request["fields"] = fields;
request["active_only"] = true;
if (not m_CurrentBlockHash.empty())
request["poll_block_hash"] = m_CurrentBlockHash;
@ -100,7 +101,7 @@ namespace llarp
void
LokidRpcClient::Connected()
{
constexpr auto PingInterval = 1min;
constexpr auto PingInterval = 30s;
constexpr auto NodeListUpdateInterval = 30s;
auto makePingRequest = [self = shared_from_this()]() {
@ -113,7 +114,6 @@ namespace llarp
},
payload.dump());
};
makePingRequest();
m_lokiMQ->add_timer(makePingRequest, PingInterval);
m_lokiMQ->add_timer(
[self = shared_from_this()]() { self->UpdateServiceNodeList(); }, NodeListUpdateInterval);

@ -62,7 +62,9 @@ Build requirements:
* C++ 17 capable C++ compiler
* libuv >= 1.27.0
* libsodium >= 1.0.18
* gcovr (if generating test coverage with gcc)
* libunbound
* libzmq
* sqlite3
### Linux
@ -71,9 +73,9 @@ build:
$ 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
$ mkdir build
$ mkdir build
$ cd build
$ cmake ..
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
$ make -j$(nproc)
install:
@ -84,14 +86,14 @@ install:
build:
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
$ mkdir build
$ mkdir build
$ cd build
$ cmake ..
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
$ make -j$(nproc)
install:
$ sudo make install
@ -106,16 +108,16 @@ additional build requirements:
* cpack
setup:
$ sudo apt install build-essential cmake git pkg-config mingw-w64 nsis
building:
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ mkdir build-windows
$ cd build-windows
$ cmake -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -DCMAKE_TOOLCHAIN_FILE='../contrib/cross/mingw64.cmake' -DWITH_TESTS=OFF -DCMAKE_CROSSCOMPILING=ON ..
$ 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 ..
$ cpack -D CPACK_MONOLITHIC_INSTALL=1 -G NSIS ..
### Solaris 2.10+
@ -146,7 +148,7 @@ install:
build:
$ pkg install cmake git curl libuv libsodium pkgconf
$ pkg install cmake git curl libuv libsodium pkgconf libunbound
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ mkdir build

@ -67,20 +67,25 @@ Requerimientos de compilación:
* GNU Make
* CMake
* Compilador C++ que pueda usar C++ 17
* Compilador C++ que pueda usar C++ 17
* gcovr (para generar la covertura de prueba en gcc)
* libuv >= 1.27.0
* libsodium >= 1.0.18
* libcurl
* libunbound
* libzmq
* sqlite3
### Linux
compilando:
$ sudo apt install build-essential cmake git libcap-dev curl libuv1-dev libsodium-dev
$ git clone https://github.com/loki-project/loki-network
$ 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
$ make
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
$ make
instalando:
@ -97,9 +102,12 @@ esto coloca el paquete compilado en `../`
compilando:
este seguro que usted tiene cmake y las herramientas de terminal de xcode ya instaladas
$ git clone https://github.com/loki-project/loki-network
$ cd loki-network
$ mkdir build
$ cd build
$ cmake ..
$ make -j8
instalando:
@ -159,9 +167,12 @@ PENDIENTE: agregar instrucciones para pkgsrc
compilando:
# pkg_add curl cmake git (opcional: ninja ccache)
$ git clone https://github.com/loki-project/loki-network
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ gmake -j8
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
$ make
instalando (root):
@ -172,9 +183,12 @@ instalando (root):
compilando:
$ pkg install cmake git curl libuv-1.27.0 libsodium
$ git clone https://github.com/loki-project/loki-network
$ git clone --recursive https://github.com/loki-project/loki-network
$ cd loki-network
$ gmake -j8
$ mkdir build
$ cd build
$ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON
$ make
instalando (root):

@ -19,6 +19,7 @@ make_context()
conf.bootstrap.skipBootstrap = true;
conf.api.m_enableRPCServer = false;
conf.router.m_enablePeerStats = true;
conf.lokid.whitelistRouters = false;
conf.router.m_publicAddress = llarp::IpAddress("1.1.1.1");
// make a fake inbound link
conf.links.m_InboundLinks.emplace_back();

Loading…
Cancel
Save