Merge remote-tracking branch 'origin/master'

pull/576/head
Jeff Becker 5 years ago
commit af1529fa72
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -21,6 +21,8 @@ option(WITH_SHARED "build shared library")
option(WITH_COVERAGE "generate coverage data") option(WITH_COVERAGE "generate coverage data")
option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF) option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF)
include(cmake/target_link_libraries_system.cmake)
# Basic definitions # Basic definitions
get_filename_component(CORE_INCLUDE include ABSOLUTE) get_filename_component(CORE_INCLUDE include ABSOLUTE)
get_filename_component(ABYSS_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/${ABYSS}/include" ABSOLUTE) get_filename_component(ABYSS_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/${ABYSS}/include" ABSOLUTE)
@ -86,7 +88,7 @@ endif(WIN32 AND NOT STATIC_LINK_RUNTIME)
add_subdirectory(vendor/cxxopts) add_subdirectory(vendor/cxxopts)
add_subdirectory(vendor/nlohmann) add_subdirectory(vendor/nlohmann)
include_directories(vendor/cxxopts/include) include_directories(SYSTEM vendor/cxxopts/include)
# still need the headers unconditionally # still need the headers unconditionally
set(ABSEIL_DIR vendor/abseil-cpp) set(ABSEIL_DIR vendor/abseil-cpp)
@ -372,7 +374,7 @@ set(ABYSS_SRC
add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC}) add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC})
add_subdirectory(${ABSEIL_DIR}) add_subdirectory(${ABSEIL_DIR})
include_directories(${ABSEIL_DIR}) include_directories(SYSTEM ${ABSEIL_DIR})
add_subdirectory(crypto) add_subdirectory(crypto)
add_subdirectory(libutp) add_subdirectory(libutp)
@ -396,7 +398,7 @@ target_include_directories(${ABYSS_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${AB
# for freebsd # for freebsd
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
target_include_directories(${ABYSS_LIB} PUBLIC /usr/local/include) target_include_directories(${ABYSS_LIB} SYSTEM PUBLIC /usr/local/include)
endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
add_log_tag(${ABYSS_EXE}) add_log_tag(${ABYSS_EXE})
add_log_tag(${ABYSS_LIB}) add_log_tag(${ABYSS_LIB})
@ -419,7 +421,7 @@ else()
add_executable(${EXE} ${EXE_SRC}) add_executable(${EXE} ${EXE_SRC})
elseif(NOT MSVC_VERSION) elseif(NOT MSVC_VERSION)
add_executable(${EXE} ${EXE_SRC} llarp/win32/version.rc) add_executable(${EXE} ${EXE_SRC} llarp/win32/version.rc)
else() else()
add_executable(${EXE} ${EXE_SRC}) add_executable(${EXE} ${EXE_SRC})
endif(NOT WIN32) endif(NOT WIN32)

@ -0,0 +1,9 @@
# This adds a dependency as a "system" dep - e.g -isystem
function(target_link_libraries_system target)
set(libs ${ARGN})
foreach(lib ${libs})
get_target_property(lib_include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target} SYSTEM PUBLIC ${lib_include_dirs})
target_link_libraries(${target} ${lib})
endforeach(lib)
endfunction()

@ -34,4 +34,4 @@ extern "C"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

@ -27,14 +27,6 @@ handle_signal(int sig)
llarp_main_signal(ctx, sig); llarp_main_signal(ctx, sig);
} }
int
printHelp(const char *argv0, int code = 1)
{
std::cout << "usage: " << argv0 << " [-h] [-v] [-g|-c] config.ini"
<< std::endl;
return code;
}
#ifdef _WIN32 #ifdef _WIN32
int int
startWinsock() startWinsock()
@ -72,8 +64,9 @@ resolvePath(std::string conffname)
char *resolvedPath = realpath(exp_result.we_wordv[0], NULL); char *resolvedPath = realpath(exp_result.we_wordv[0], NULL);
if(!resolvedPath) if(!resolvedPath)
{ {
llarp::LogWarn("Can't resolve path: ", exp_result.we_wordv[0]); // relative paths don't need to be resolved
return ""; // llarp::LogWarn("Can't resolve path: ", exp_result.we_wordv[0]);
return conffname;
} }
return resolvedPath; return resolvedPath;
#else #else
@ -106,13 +99,13 @@ main(int argc, char *argv[])
// clang-format off // clang-format off
cxxopts::Options options( cxxopts::Options options(
"lokinet", "lokinet",
"Lokinet is a private, decentralized and IP based overlay network for the internet" "LokiNET is a free, open source, private, decentralized, \"market based sybil resistant\" and IP based onion routing network"
); );
options.add_options() options.add_options()
("v,verbose", "Verbose", cxxopts::value<bool>()) ("v,verbose", "Verbose", cxxopts::value<bool>())
("h,help", "help", cxxopts::value<bool>()) ("h,help", "help", cxxopts::value<bool>())
("g,generate", "generate config", cxxopts::value<bool>()) ("g,generate", "generate client config", cxxopts::value<bool>())
("r,router", "run as router", cxxopts::value<bool>()) ("r,router", "generate router config", cxxopts::value<bool>())
("f,force", "overwrite", cxxopts::value<bool>()) ("f,force", "overwrite", cxxopts::value<bool>())
("config","path to configuration file", cxxopts::value<std::string>()); ("config","path to configuration file", cxxopts::value<std::string>());
@ -136,7 +129,8 @@ main(int argc, char *argv[])
if(result.count("help")) if(result.count("help"))
{ {
return printHelp(argv[0], 0); std::cout << options.help() << std::endl;
return 0;
} }
if(result.count("generate") > 0) if(result.count("generate") > 0)
@ -152,6 +146,9 @@ main(int argc, char *argv[])
if(result.count("router") > 0) if(result.count("router") > 0)
{ {
asRouter = true; asRouter = true;
// we should generate and exit (docker needs this, so we don't write a
// config each time on startup)
genconfigOnly = true;
} }
if(result.count("config") > 0) if(result.count("config") > 0)
@ -166,7 +163,8 @@ main(int argc, char *argv[])
catch(const cxxopts::option_not_exists_exception &ex) catch(const cxxopts::option_not_exists_exception &ex)
{ {
std::cerr << ex.what(); std::cerr << ex.what();
return printHelp(argv[0]); std::cout << options.help() << std::endl;
return 1;
} }
if(!conffname.empty()) if(!conffname.empty())

@ -6,13 +6,10 @@ RUN apt update && \
WORKDIR /src/ WORKDIR /src/
COPY . /src/ COPY . /src/
# 12p/24l cores takes 8gb RUN make NINJA=ninja
ARG BIG_AND_FAST="false" #RUN ./lokinet -r -f
COPY lokinet-docker.ini /root/.lokinet/lokinet.ini
RUN if [ "false$BIG_AND_FAST" = "false" ] ; then make ; else make NINJA=ninja ; fi RUN ./lokinet-bootstrap
RUN find . -name lokinet
RUN ./lokinet -g -f
RUN ./lokinet-bootstrap http://206.81.100.174/n-st-1.signed
CMD ["./lokinet"] CMD ["./lokinet"]
EXPOSE 1090/udp EXPOSE 1090/udp 1190/tcp

@ -1,5 +1,5 @@
#ifndef __ABYSS_CLIENT_HPP__ #ifndef ABYSS_CLIENT_HPP
#define __ABYSS_CLIENT_HPP__ #define ABYSS_CLIENT_HPP
#include <ev/ev.h> #include <ev/ev.h>
#include <util/json.hpp> #include <util/json.hpp>

@ -1,5 +1,5 @@
#ifndef __ABYSS_HTTP_HPP__ #ifndef ABYSS_HTTP_HPP
#define __ABYSS_HTTP_HPP__ #define ABYSS_HTTP_HPP
#include <util/json.hpp> #include <util/json.hpp>
#include <util/string_view.hpp> #include <util/string_view.hpp>

@ -1,5 +1,5 @@
#ifndef __ABYSS_SERVER_HPP__ #ifndef ABYSS_SERVER_HPP
#define __ABYSS_SERVER_HPP__ #define ABYSS_SERVER_HPP
#include <ev/ev.h> #include <ev/ev.h>
#include <util/json.hpp> #include <util/json.hpp>

@ -84,7 +84,7 @@ struct DemoClient : public abyss::http::JSONRPC
QueueRPC("test", nlohmann::json::object(), QueueRPC("test", nlohmann::json::object(),
std::bind(&DemoClient::NewConn, this, std::placeholders::_1)); std::bind(&DemoClient::NewConn, this, std::placeholders::_1));
Flush(); Flush();
}; }
}; };
struct DemoServer : public abyss::httpd::BaseReqHandler struct DemoServer : public abyss::httpd::BaseReqHandler

@ -46,12 +46,11 @@ set(LIB_UTIL_SRC
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC}) add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include) target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(${UTIL_LIB} PUBLIC absl::synchronization absl::hash) target_link_libraries_system(${UTIL_LIB} absl::synchronization absl::hash nlohmann_json::nlohmann_json)
target_link_libraries(${UTIL_LIB} PUBLIC nlohmann_json::nlohmann_json)
# cut back on fluff # cut back on fluff
if (NOT WIN32) if (NOT WIN32)
target_link_libraries(${UTIL_LIB} PUBLIC absl::optional absl::variant absl::strings cppbackport) target_link_libraries_system(${UTIL_LIB} absl::optional absl::variant absl::strings cppbackport)
endif(NOT WIN32) endif(NOT WIN32)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@ -258,6 +257,12 @@ if(WITH_SHARED)
add_log_tag(${SHARED_LIB}) add_log_tag(${SHARED_LIB})
endif() endif()
if (WARNINGS_AS_ERRORS)
set(WARN_FLAGS -Wall -Wextra -Wextra-semi -Werror)
target_compile_options(${UTIL_LIB} PUBLIC ${WARN_FLAGS})
target_compile_options(${PLATFORM_LIB} PUBLIC ${WARN_FLAGS})
target_compile_options(${STATIC_LIB} PUBLIC ${WARN_FLAGS})
endif()
add_log_tag(${UTIL_LIB}) add_log_tag(${UTIL_LIB})
add_log_tag(${PLATFORM_LIB}) add_log_tag(${PLATFORM_LIB})
add_log_tag(${STATIC_LIB}) add_log_tag(${STATIC_LIB})

@ -94,6 +94,8 @@ namespace llarp
} // namespace llarp } // namespace llarp
/// fname should be a relative path (from CWD) or absolute path to the config
/// file
extern "C" bool extern "C" bool
llarp_ensure_config(const char *fname, const char *basedir, bool overwrite, llarp_ensure_config(const char *fname, const char *basedir, bool overwrite,
bool asRouter) bool asRouter)
@ -122,13 +124,12 @@ llarp_ensure_config(const char *fname, const char *basedir, bool overwrite,
llarp::LogInfo("Attempting to create config file ", fname); llarp::LogInfo("Attempting to create config file ", fname);
// abort if client.ini already exists // abort if config already exists
if(!asRouter) if(!asRouter)
{ {
if(fs::exists(basepath + "client.ini", ec) && !overwrite) if(fs::exists(fname, ec) && !overwrite)
{ {
llarp::LogError( llarp::LogError(fname, " currently exists, please use -f to overwrite");
basepath, "client.ini currently exists, please use -f to overwrite");
return true; return true;
} }
if(ec) if(ec)
@ -179,7 +180,7 @@ llarp_generic_ensure_config(std::ofstream &f, std::string basepath)
f << std::endl; f << std::endl;
f << "# uncomment following line to set router nickname to 'lokinet'" f << "# uncomment following line to set router nickname to 'lokinet'"
<< std::endl; << std::endl;
f << "# nickname=lokinet" << std::endl; f << "#nickname=lokinet" << std::endl;
f << std::endl << std::endl; f << std::endl << std::endl;
// logging // logging
@ -200,21 +201,15 @@ llarp_generic_ensure_config(std::ofstream &f, std::string basepath)
f << "# admin api (disabled by default)" << std::endl; f << "# admin api (disabled by default)" << std::endl;
f << "[api]" << std::endl; f << "[api]" << std::endl;
f << "enabled=false" << std::endl; f << "enabled=false" << std::endl;
f << "# authkey=insertpubkey1here" << std::endl; f << "#authkey=insertpubkey1here" << std::endl;
f << "# authkey=insertpubkey2here" << std::endl; f << "#authkey=insertpubkey2here" << std::endl;
f << "# authkey=insertpubkey3here" << std::endl; f << "#authkey=insertpubkey3here" << std::endl;
f << "bind=127.0.0.1:1190" << std::endl; f << "bind=127.0.0.1:1190" << std::endl;
f << std::endl << std::endl; f << std::endl << std::endl;
f << "# system settings for privileges and such" << std::endl; f << "# system settings for privileges and such" << std::endl;
f << "[system]" << std::endl; f << "[system]" << std::endl;
#ifdef _WIN32
f << "# ";
#endif
f << "user=" << DEFAULT_LOKINET_USER << std::endl; f << "user=" << DEFAULT_LOKINET_USER << std::endl;
#ifdef _WIN32
f << "# ";
#endif
f << "group=" << DEFAULT_LOKINET_GROUP << std::endl; f << "group=" << DEFAULT_LOKINET_GROUP << std::endl;
f << "pidfile=" << basepath << "lokinet.pid" << std::endl; f << "pidfile=" << basepath << "lokinet.pid" << std::endl;
f << std::endl << std::endl; f << std::endl << std::endl;
@ -251,8 +246,9 @@ llarp_generic_ensure_config(std::ofstream &f, std::string basepath)
<< std::endl; << std::endl;
f << "# if we don't have any peers we connect to this router" << std::endl; f << "# if we don't have any peers we connect to this router" << std::endl;
f << "add-node=" << basepath << "bootstrap.signed" << std::endl; f << "add-node=" << basepath << "bootstrap.signed" << std::endl;
f << "# add another bootstrap node" << std::endl; // we only process one of these...
f << "#add-node=/path/to/alternative/self.signed" << std::endl; // f << "# add another bootstrap node" << std::endl;
// f << "#add-node=/path/to/alternative/self.signed" << std::endl;
f << std::endl << std::endl; f << std::endl << std::endl;
} }
@ -268,13 +264,14 @@ llarp_ensure_router_config(std::ofstream &f, std::string basepath)
f << "# network settings " << std::endl; f << "# network settings " << std::endl;
f << "[network]" << std::endl; f << "[network]" << std::endl;
f << "profiles=" << basepath << "profiles.dat" << std::endl; f << "profiles=" << basepath << "profiles.dat" << std::endl;
f << "ifaddr=10.105.0.1/16" << std::endl; // better to let the routers auto-configure
f << "ifname=lokitun0" << std::endl; // f << "ifaddr=auto" << std::endl;
// f << "ifname=auto" << std::endl;
f << "enabled=true" << std::endl; f << "enabled=true" << std::endl;
f << "exit=false" << std::endl; f << "exit=false" << std::endl;
f << "# exit-blacklist=tcp:25" << std::endl; f << "#exit-blacklist=tcp:25" << std::endl;
f << "# exit-whitelist=tcp:*" << std::endl; f << "#exit-whitelist=tcp:*" << std::endl;
f << "# exit-whitelist=udp:*" << std::endl; f << "#exit-whitelist=udp:*" << std::endl;
f << std::endl; f << std::endl;
f << "# ROUTERS ONLY: publish network interfaces for handling inbound traffic" f << "# ROUTERS ONLY: publish network interfaces for handling inbound traffic"
<< std::endl; << std::endl;
@ -285,7 +282,7 @@ llarp_ensure_router_config(std::ofstream &f, std::string basepath)
f << ifname << "=1090" << std::endl; f << ifname << "=1090" << std::endl;
else else
f << "# could not autodetect network interface" << std::endl f << "# could not autodetect network interface" << std::endl
<< "# eth0=1090" << std::endl; << "#eth0=1090" << std::endl;
f << std::endl; f << std::endl;
} }
@ -293,39 +290,49 @@ llarp_ensure_router_config(std::ofstream &f, std::string basepath)
bool bool
llarp_ensure_client_config(std::ofstream &f, std::string basepath) llarp_ensure_client_config(std::ofstream &f, std::string basepath)
{ {
// write snapp-example.ini
const std::string snappExample_fpath = basepath + "snapp-example.ini"; const std::string snappExample_fpath = basepath + "snapp-example.ini";
// done with fname.ini
// start client.ini
// write fname ini
{ {
std::ofstream clientini_f(snappExample_fpath, std::ofstream example_f(snappExample_fpath,
std::ios::binary | std::ios::out); std::ios::binary | std::ios::out);
if(f.is_open()) if(f.is_open())
{ {
clientini_f << "# this is an example configuration for a snapp" // pick ip
<< std::endl; std::string ip = llarp::findFreePrivateRange();
clientini_f << "[example-snapp]" << std::endl; if(ip == "")
clientini_f << "# keyfile is the path to the private key of the snapp" {
<< std::endl; llarp::LogError(
clientini_f << "keyfile=" << basepath << "example-snap-keyfile.private" "Couldn't easily detect a private range to map lokinet onto");
<< std::endl; return false;
clientini_f << "# ifaddr is the ip range to allocate to this snapp" }
<< std::endl; example_f << "# this is an example configuration for a snapp"
clientini_f << "ifaddr=10.55.0.0/16" << std::endl; << std::endl;
clientini_f << "# ifname is the name to try and give to the network " example_f << "[example-snapp]" << std::endl;
"interface this snap owns" example_f << "# keyfile is the path to the private key of the snapp, "
<< std::endl; "your .loki is tied to this key, DON'T LOSE IT"
clientini_f << "ifname=snapp-tun0" << std::endl; << std::endl;
example_f << "keyfile=" << basepath << "example-snap-keyfile.private"
<< std::endl;
example_f << "# ifaddr is the ip range to allocate to this snapp"
<< std::endl;
example_f << "ifaddr=" << ip << std::endl;
// probably fine to leave this (and not-auto-detect it) I'm not worried
// about any collisions
example_f << "# ifname is the name to try and give to the network "
"interface this snap owns"
<< std::endl;
example_f << "ifname=snapp-tun0" << std::endl;
} }
else else
{ {
llarp::LogError("failed to write ", snappExample_fpath); llarp::LogError("failed to write ", snappExample_fpath);
} }
} }
// now do up fname
f << std::endl << std::endl; f << std::endl << std::endl;
f << "# snapps configuration section" << std::endl; f << "# snapps configuration section" << std::endl;
f << "[services]"; f << "[services]";
f << "# uncomment next line to enable persistant snapp" << std::endl; f << "# uncomment next line to enable a snapp" << std::endl;
f << "#example-snapp=" << snappExample_fpath << std::endl; f << "#example-snapp=" << snappExample_fpath << std::endl;
f << std::endl << std::endl; f << std::endl << std::endl;
@ -339,57 +346,14 @@ llarp_ensure_client_config(std::ofstream &f, std::string basepath)
f << "# uncomment next line to use router with pubkey as an exit node" f << "# uncomment next line to use router with pubkey as an exit node"
<< std::endl; << std::endl;
f << "#exit-node=pubkey" << std::endl; f << "#exit-node=pubkey" << std::endl;
// pick ip
std::string ip = llarp::findFreePrivateRange();
/*
struct privatesInUse ifsInUse = llarp_getPrivateIfs();
std::string ip = "";
if(!ifsInUse.ten)
{
ip = "10.10.0.1/24";
}
else if(!ifsInUse.oneSeven)
{
ip = "172.16.10.1/24";
}
else if(!ifsInUse.oneNine)
{
ip = "192.168.10.1/24";
}
else
{
llarp::LogError(
"Couldn't easily detect a private range to map lokinet onto");
return false;
}
*/
if(ip == "")
{
llarp::LogError(
"Couldn't easily detect a private range to map lokinet onto");
return false;
}
llarp::LogDebug("Detected " + ip
+ " is available for use, configuring as such");
// clientini_f << "ifaddr=" << ip << std::endl;
// pick interface name
std::string ifName = llarp::findFreeLokiTunIfName();
if(ifName == "")
{
llarp::LogError("Could not find any free lokitun interface names");
return false;
}
/*
clientini_f << "ifname=lokinum" << std::to_string(num) << std::endl;
// prefetch-tags=test
// enable netns?
llarp::LogInfo("Generated hidden service client as " + basepath // better to set them to auto then to hard code them now
+ "client.ini"); // operating environment may change over time and this will help adapt
*/ // f << "ifname=auto" << std::endl;
// f << "ifaddr=auto" << std::endl;
f << "ifname=" << ifName << std::endl; // should this also be auto? or not declared?
f << "ifaddr=" << ip << std::endl; // probably auto in case they want to set up a hidden service
f << "enabled=true" << std::endl; f << "enabled=true" << std::endl;
return true; return true;
} }

@ -78,7 +78,9 @@ namespace llarp
struct SecretKey final : public AlignedBuffer< SECKEYSIZE > struct SecretKey final : public AlignedBuffer< SECKEYSIZE >
{ {
SecretKey() : AlignedBuffer< SECKEYSIZE >(){}; SecretKey() : AlignedBuffer< SECKEYSIZE >()
{
}
explicit SecretKey(const SecretKey &k) : AlignedBuffer< SECKEYSIZE >(k) explicit SecretKey(const SecretKey &k) : AlignedBuffer< SECKEYSIZE >(k)
{ {
@ -127,7 +129,9 @@ namespace llarp
/// IdentitySecret is a secret key from a service node secret seed /// IdentitySecret is a secret key from a service node secret seed
struct IdentitySecret final : public AlignedBuffer< 32 > struct IdentitySecret final : public AlignedBuffer< 32 >
{ {
IdentitySecret() : AlignedBuffer< 32 >(){}; IdentitySecret() : AlignedBuffer< 32 >()
{
}
friend std::ostream & friend std::ostream &
operator<<(std::ostream &out, const IdentitySecret &) operator<<(std::ostream &out, const IdentitySecret &)

@ -19,7 +19,9 @@ 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(r)
{
}
util::StatusObject util::StatusObject
ExtractStatus() const ExtractStatus() const

@ -11,13 +11,15 @@ namespace llarp
{ {
const Key_t& us; const Key_t& us;
XorMetric(const Key_t& ourKey) : us(ourKey){}; XorMetric(const Key_t& ourKey) : us(ourKey)
{
}
bool bool
operator()(const Key_t& left, const Key_t& right) const operator()(const Key_t& left, const Key_t& right) const
{ {
return (us ^ left) < (us ^ right); return (us ^ left) < (us ^ right);
}; }
}; };
} // namespace dht } // namespace dht
} // namespace llarp } // namespace llarp

@ -101,7 +101,9 @@ namespace llarp
{ {
ListDecoder(const Key_t &from, ListDecoder(const Key_t &from,
std::vector< std::unique_ptr< IMessage > > &list) std::vector< std::unique_ptr< IMessage > > &list)
: From(from), l(list){}; : From(from), l(list)
{
}
bool relayed = false; bool relayed = false;
const Key_t &From; const Key_t &From;

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

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

@ -28,7 +28,9 @@ namespace llarp
{ {
huint32_t ipaddr; huint32_t ipaddr;
virtual ~type_1a(){}; virtual ~type_1a()
{
}
type_1a(); type_1a();
bool bool
@ -42,7 +44,9 @@ namespace llarp
{ {
std::string ns; std::string ns;
virtual ~type_2ns(){}; virtual ~type_2ns()
{
}
type_2ns(); type_2ns();
bool bool
@ -62,7 +66,9 @@ namespace llarp
uint32_t expire; uint32_t expire;
uint32_t minimum; uint32_t minimum;
virtual ~type_6soa(){}; virtual ~type_6soa()
{
}
type_6soa(); type_6soa();
bool bool
@ -76,7 +82,9 @@ namespace llarp
{ {
std::string cname; std::string cname;
virtual ~type_5cname(){}; virtual ~type_5cname()
{
}
type_5cname(); type_5cname();
bool bool
@ -90,7 +98,9 @@ namespace llarp
{ {
std::string revname; std::string revname;
virtual ~type_12ptr(){}; virtual ~type_12ptr()
{
}
type_12ptr(); type_12ptr();
bool bool
@ -105,7 +115,9 @@ namespace llarp
std::string mx; std::string mx;
uint16_t priority; uint16_t priority;
virtual ~type_15mx(){}; virtual ~type_15mx()
{
}
type_15mx(); type_15mx();
bool bool
@ -119,7 +131,9 @@ namespace llarp
{ {
std::string txt; std::string txt;
virtual ~type_16txt(){}; virtual ~type_16txt()
{
}
type_16txt(); type_16txt();
bool bool

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

@ -12,7 +12,7 @@ namespace llarp
/// base type for serializable dns entities /// base type for serializable dns entities
struct Serialize struct Serialize
{ {
virtual ~Serialize() = default; virtual ~Serialize() = 0;
/// encode entity to buffer /// encode entity to buffer
virtual bool virtual bool

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

@ -383,14 +383,14 @@ namespace llarp
__attribute__((unused)) size_t sz) __attribute__((unused)) size_t sz)
{ {
return -1; return -1;
}; }
/// return false if we want to deregister and remove ourselves /// return false if we want to deregister and remove ourselves
virtual bool virtual bool
tick() tick()
{ {
return true; return true;
}; }
/// used for tun interface and tcp conn /// used for tun interface and tcp conn
virtual ssize_t virtual ssize_t
@ -423,7 +423,9 @@ namespace llarp
} }
virtual void virtual void
before_flush_write(){}; before_flush_write()
{
}
/// called in event loop when fd is ready for writing /// called in event loop when fd is ready for writing
/// requeues anything not written /// requeues anything not written
@ -505,7 +507,7 @@ namespace llarp
virtual ~posix_ev_io() virtual ~posix_ev_io()
{ {
close(fd); close(fd);
}; }
}; };
#endif #endif
@ -755,7 +757,9 @@ struct llarp_ev_loop
virtual bool virtual bool
add_ev(llarp::ev_io* ev, bool write) = 0; add_ev(llarp::ev_io* ev, bool write) = 0;
virtual ~llarp_ev_loop(){}; virtual ~llarp_ev_loop()
{
}
std::list< std::unique_ptr< llarp::ev_io > > handlers; std::list< std::unique_ptr< llarp::ev_io > > handlers;

@ -371,18 +371,19 @@ llarp_kqueue_loop::tick(int ms)
llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].udata); llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].udata);
if(ev) if(ev)
{ {
if(events[idx].filter & EVFILT_READ) // it'll crash if we flip these
if(events[idx].filter & EVFILT_WRITE)
{ {
IO([&]() -> ssize_t { IO([&]() -> ssize_t {
return ev->read( ev->flush_write_buffers(events[idx].data);
readbuf, std::min(sizeof(readbuf), size_t(events[idx].data))); return 0;
}); });
} }
if(events[idx].filter & EVFILT_WRITE) if(events[idx].filter & EVFILT_READ)
{ {
IO([&]() -> ssize_t { IO([&]() -> ssize_t {
ev->flush_write_buffers(events[idx].data); return ev->read(
return 0; readbuf, std::min(sizeof(readbuf), size_t(events[idx].data)));
}); });
} }
} }

@ -22,7 +22,9 @@ namespace llarp
{ {
llarp_udp_io* udp; llarp_udp_io* udp;
udp_listener(int fd, llarp_udp_io* u) : ev_io(fd), udp(u){}; udp_listener(int fd, llarp_udp_io* u) : ev_io(fd), udp(u)
{
}
~udp_listener() ~udp_listener()
{ {
@ -45,7 +47,9 @@ namespace llarp
tun(llarp_tun_io* tio, llarp_ev_loop_ptr l) tun(llarp_tun_io* tio, llarp_ev_loop_ptr l)
: ev_io(-1, new LossyWriteQueue_t("kqueue_tun_write", l, l)) : ev_io(-1, new LossyWriteQueue_t("kqueue_tun_write", l, l))
, t(tio) , t(tio)
, tunif(tuntap_init()){}; , tunif(tuntap_init())
{
}
int int
sendto(__attribute__((unused)) const sockaddr* to, sendto(__attribute__((unused)) const sockaddr* to,

@ -154,9 +154,11 @@ namespace llarp
ExitSession(const llarp::RouterID& snodeRouter, ExitSession(const llarp::RouterID& snodeRouter,
std::function< bool(const llarp_buffer_t&) > writepkt, std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen) AbstractRouter* r, size_t numpaths, size_t hoplen)
: BaseSession(snodeRouter, writepkt, r, numpaths, hoplen){}; : BaseSession(snodeRouter, writepkt, r, numpaths, hoplen)
{
}
~ExitSession(){}; ~ExitSession() = default;
std::string std::string
Name() const override; Name() const override;
@ -178,7 +180,7 @@ namespace llarp
AbstractRouter* r, size_t numpaths, size_t hoplen, AbstractRouter* r, size_t numpaths, size_t hoplen,
bool useRouterSNodeKey = false); bool useRouterSNodeKey = false);
~SNodeSession(){}; ~SNodeSession() = default;
std::string std::string
Name() const override; Name() const override;

@ -13,7 +13,9 @@ namespace llarp
{ {
NullEndpoint(const std::string &name, AbstractRouter *r, NullEndpoint(const std::string &name, AbstractRouter *r,
llarp::service::Context *parent) llarp::service::Context *parent)
: llarp::service::Endpoint(name, r, parent){}; : llarp::service::Endpoint(name, r, parent)
{
}
bool bool
HandleWriteIPPacket(const llarp_buffer_t &, HandleWriteIPPacket(const llarp_buffer_t &,

@ -15,7 +15,9 @@ namespace llarp
struct ILinkLayer; struct ILinkLayer;
struct ILinkSession struct ILinkSession
{ {
virtual ~ILinkSession(){}; virtual ~ILinkSession()
{
}
/// hook for utp for when we have established a connection /// hook for utp for when we have established a connection
virtual void virtual void

@ -13,7 +13,9 @@ namespace llarp
uint64_t pathCreated; uint64_t pathCreated;
PathConfirmMessage(); PathConfirmMessage();
PathConfirmMessage(uint64_t lifetime); PathConfirmMessage(uint64_t lifetime);
~PathConfirmMessage(){}; ~PathConfirmMessage()
{
}
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -29,7 +31,7 @@ namespace llarp
{ {
pathLifetime = 0; pathLifetime = 0;
pathCreated = 0; pathCreated = 0;
}; }
}; };
} // namespace routing } // namespace routing
} // namespace llarp } // namespace llarp

@ -24,7 +24,7 @@ namespace llarp
{ {
T = 0; T = 0;
L = 0; L = 0;
}; }
bool bool
HandleMessage(IMessageHandler* h, AbstractRouter* r) const override; HandleMessage(IMessageHandler* h, AbstractRouter* r) const override;

@ -131,7 +131,7 @@ namespace llarp
in_addr_t addr = this->addr4()->s_addr; in_addr_t addr = this->addr4()->s_addr;
uint32_t byte = ntohl(addr); uint32_t byte = ntohl(addr);
return byte; return byte;
}; }
bool bool
isTenPrivate(uint32_t byte); isTenPrivate(uint32_t byte);

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

@ -21,9 +21,11 @@ namespace llarp
llarp_time_t lastUpdated = 0; llarp_time_t lastUpdated = 0;
llarp_time_t lastDecay = 0; llarp_time_t lastDecay = 0;
RouterProfile() : IBEncodeMessage(){}; RouterProfile() : IBEncodeMessage()
{
}
~RouterProfile(){}; ~RouterProfile() = default;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;

@ -21,7 +21,9 @@ namespace llarp
{ {
} }
virtual ~IMessage(){}; virtual ~IMessage()
{
}
virtual bool virtual bool
HandleMessage(IMessageHandler* h, AbstractRouter* r) const = 0; HandleMessage(IMessageHandler* h, AbstractRouter* r) const = 0;

@ -98,7 +98,7 @@ namespace llarp
version = other.version; version = other.version;
UpdateAddr(); UpdateAddr();
return *this; return *this;
}; }
bool bool
operator<(const ServiceInfo& other) const operator<(const ServiceInfo& other) const

@ -24,7 +24,9 @@ namespace llarp
struct IServiceLookup struct IServiceLookup
{ {
IServiceLookup() = delete; IServiceLookup() = delete;
virtual ~IServiceLookup(){}; virtual ~IServiceLookup()
{
}
/// handle lookup result /// handle lookup result
virtual bool virtual bool

@ -47,7 +47,7 @@ namespace llarp
{ {
(void)rebuild; (void)rebuild;
return true; return true;
}; }
virtual void virtual void
UpdateIntroSet(bool randomizePath = false) = 0; UpdateIntroSet(bool randomizePath = false) = 0;

@ -227,7 +227,9 @@ namespace llarp
/// bencode serializable message /// bencode serializable message
struct IBEncodeMessage struct IBEncodeMessage
{ {
virtual ~IBEncodeMessage(){}; virtual ~IBEncodeMessage()
{
}
IBEncodeMessage(uint64_t v = LLARP_PROTO_VERSION) IBEncodeMessage(uint64_t v = LLARP_PROTO_VERSION)
{ {

@ -27,7 +27,7 @@ llarp_buffer_t::writef(const char* fmt, ...)
va_end(args); va_end(args);
if(written <= 0) if(written <= 0)
return false; return false;
if(sz < written) if(sz < static_cast< size_t >(written))
return false; return false;
cur += written; cur += written;
return true; return true;

@ -7,7 +7,7 @@
namespace llarp namespace llarp
{ {
/// fluhsable file based log stream /// flushable file based log stream
struct FileLogStream : public ILogStream struct FileLogStream : public ILogStream
{ {
FileLogStream(llarp_threadpool* disk, FILE* f, llarp_time_t flushInterval); FileLogStream(llarp_threadpool* disk, FILE* f, llarp_time_t flushInterval);
@ -25,7 +25,9 @@ namespace llarp
Tick(llarp_time_t now) override; Tick(llarp_time_t now) override;
void void
PostLog(std::stringstream&) const override{}; PostLog(std::stringstream&) const override
{
}
private: private:
struct FlushEvent struct FlushEvent
@ -58,4 +60,4 @@ namespace llarp
}; };
} // namespace llarp } // namespace llarp
#endif #endif

@ -14,7 +14,7 @@ namespace llarp
{ {
struct IParser struct IParser
{ {
virtual ~IParser(){}; virtual ~IParser(){}
/// result from feeding data to parser /// result from feeding data to parser
enum Result enum Result

@ -17,7 +17,9 @@ namespace llarp
void void
PostLog(std::stringstream& ss) const override; PostLog(std::stringstream& ss) const override;
void Tick(llarp_time_t) override{}; void Tick(llarp_time_t) override
{
}
}; };
} // namespace llarp } // namespace llarp
#endif #endif

@ -11,7 +11,9 @@ namespace llarp
/// logger stream interface /// logger stream interface
struct ILogStream struct ILogStream
{ {
virtual ~ILogStream(){}; virtual ~ILogStream()
{
}
virtual void virtual void
PreLog(std::stringstream& out, LogLevel lvl, const char* fname, PreLog(std::stringstream& out, LogLevel lvl, const char* fname,

@ -24,7 +24,9 @@ namespace llarp
virtual void virtual void
PostLog(std::stringstream& ss) const override; PostLog(std::stringstream& ss) const override;
void Tick(llarp_time_t) override{}; void Tick(llarp_time_t) override
{
}
private: private:
std::ostream& m_Out; std::ostream& m_Out;

@ -0,0 +1,82 @@
# this configuration was auto generated with 'sane' defaults
# change these values as desired
[router]
# number of crypto worker threads
threads=4
# path to store signed RC
contact-file=/root/.lokinet/self.signed
# path to store transport private key
transport-privkey=/root/.lokinet/transport.private
# path to store identity signing key
ident-privkey=/root/.lokinet/identity.private
# encryption key for onion routing
encryption-privkey=/root/.lokinet/encryption.private
# uncomment following line to set router nickname to 'lokinet'
#nickname=lokinet
[logging]
level=info
# uncomment for logging to file
#type=file
#file=/path/to/logfile
# uncomment for syslog logging
#type=syslog
[metrics]
json-metrics-path=/root/.lokinet/metrics.json
# admin api (disabled by default)
[api]
enabled=true
#authkey=insertpubkey1here
#authkey=insertpubkey2here
#authkey=insertpubkey3here
bind=127.0.0.1:1190
# system settings for privileges and such
[system]
user=lokinet
group=lokinet
pidfile=/root/.lokinet/lokinet.pid
# dns provider configuration section
[dns]
# resolver
upstream=1.1.1.1
bind=127.3.2.1:53
# network database settings block
[netdb]
# directory for network database skiplist storage
dir=/netdb
# bootstrap settings
[bootstrap]
# add a bootstrap node's signed identity to the list of nodes we want to bootstrap from
# if we don't have any peers we connect to this router
add-node=/root/.lokinet/bootstrap.signed
# lokid settings (disabled by default)
[lokid]
enabled=false
jsonrpc=127.0.0.1:22023
#service-node-seed=/path/to/servicenode/seed
# network settings
[network]
profiles=/root/.lokinet/profiles.dat
enabled=true
exit=false
#exit-blacklist=tcp:25
#exit-whitelist=tcp:*
#exit-whitelist=udp:*
ifaddr=10.200.0.1/8
ifname=loki-docker0
# ROUTERS ONLY: publish network interfaces for handling inbound traffic
[bind]
eth0=1090

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<title>LokiNET</title>
<organization>network.loki</organization>
<domains enable_localSystem="true"/>
<options customize="never" require-scripts="true" rootVolumeOnly="true" />
<!-- Define documents displayed at various steps -->
<welcome file="welcome.html" mime-type="text/html" />
<license file="license.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
<!-- List all component packages -->
<pkg-ref id="network.loki.lokinet"
version="0.4"
auth="root">lokinet.pkg</pkg-ref>
<!-- List them again here. They can now be organized
as a hierarchy if you want. -->
<choices-outline>
<line choice="network.loki.lokinet"/>
</choices-outline>
<!-- Define each choice above -->
<choice
id="network.loki.lokinet"
visible="false"
title="LokiNET"
description='LokiNET is a free, open source, private, decentralized, \"market based sybil resistant\" and IP based onion routing network'
start_selected="true">
<pkg-ref id="network.loki.lokinet"/>
</choice>
</installer-gui-script>

@ -0,0 +1,16 @@
#!/bin/sh
VERSION=$1
echo "Copying latest build"
mkdir -p osx-pkg/usr/local/bin
cp ../lokinet osx-pkg/usr/local/bin
# just incase they want to switch networks later
cp ../lokinet-bootstrap osx-pkg/usr/local/bin
echo "Building package $VERSION"
mkdir -p pkg1
rm pkg1/lokinet.pkg
pkgbuild --root osx-pkg --scripts scripts --identifier network.loki.lokinet --version $VERSION pkg1/lokinet.pkg
rm lokinet-v0.4.pkg
productbuild --distribution distribution.xml --resources resources --package-path pkg1 --version $VERSION lokinet-v$VERSION.pkg

@ -0,0 +1,3 @@
IRC or Discord is likely the best place for help with LokiNET
IRC: #llarp on irc.freenode.org

@ -0,0 +1,23 @@
LokiNET is the reference implementation of LLARP (Low Latency Anonymous
Routing Protocol) and is licensed under ZLIB license, however the protocol
specifications are placed into the public domian using the CC0 License.
Copyright (c) 2018-2019 The Loki Project
Copyright (c) 2018-2019 Jeff Becker
Windows NT port and portions Copyright (c) 2018-2019 Rick V.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

@ -0,0 +1,7 @@
Hi, welcome to LokiNET public alpha!
LokiNET is a private, decentralized and Market based, Sybil resistant overlay network for the internet.
This package contains the reference implementation of LLARP.
This software is in a very early stage where there's much work to be done.

@ -0,0 +1,27 @@
#!/bin/sh
echo "Running postinstall" > /tmp/lokinet_postinstall.log
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
rm $HOME/.lokinet/*.signed >> /tmp/lokinet_postinstall.log
rm $HOME/.lokinet/*.key >> /tmp/lokinet_postinstall.log
rm $HOME/.lokinet/*.private >> /tmp/lokinet_postinstall.log
rm -fr $HOME/.lokinet/netdb >> /tmp/lokinet_postinstall.log
url="https://i2p.rocks/i2procks.signed"
echo "downloading $url" >> /tmp/lokinet_postinstall.log
echo "to $HOME/.lokinet/bootstrap.signed" >> /tmp/lokinet_postinstall.log
# use temp file to not overrwrite existing bootstrap file on fail
tmp=/tmp/bootstrap.tmp
# MacOS does not have wget without homebrew but does have curl
# Rick also had indicated most BSDs have curl too
curl "$url" > "$tmp" && \
(mv "$tmp" "$HOME/.lokinet/bootstrap.signed" && echo "${GREEN}lokinet successfully bootstrapped${NC}" >> /tmp/lokinet_postinstall.log) \
|| echo "${RED}failed to download bootstrap from $url${NC}" >> /tmp/lokinet_postinstall.log
rm -f "$tmp"
exit 0 # all good

@ -0,0 +1,8 @@
#!/bin/sh
echo "Running preinstall" > /tmp/lokinet_preinstall.log
if [ ! -d "$HOME/.lokinet" ]
then
mkdir $HOME/.lokinet >> /tmp/lokinet_preinstall.log
fi
find $HOME/.lokinet >> /tmp/lokinet_preinstall.log
exit 0 # all good

@ -10,6 +10,54 @@ You can view documentation on how to get started [here](https://loki-project.git
![build status](https://gitlab.com/lokiproject/loki-network/badges/master/pipeline.svg "build status") ![build status](https://gitlab.com/lokiproject/loki-network/badges/master/pipeline.svg "build status")
## Usage
see the [documentation](https://loki-project.github.io/loki-docs/Lokinet/LokinetOverview/) on how to get started.
Also read the [Public Testing Guide](https://lokidocs.com/Lokinet/Guides/PublicTestingGuide/#1-lokinet-installation) for installation and other helpful information.
## Running on Linux
**DO NOT RUN AS ROOT**, run as normal user. This requires the binary to have the proper setcaps set by `make install` on the binary.
to run as client:
$ lokinet -g
$ lokinet-bootstrap
$ lokinet
to run as relay:
$ lokinet -r
$ lokinet-bootstrap
$ lokinet
## Running on MacOS/UNIX/BSD
**YOU HAVE TO RUN AS ROOT**, run using sudo. Elevated privileges are needed to create the virtual tunnel interface.
The MacOS installer places the normal binaries (`lokinet` and `lokinet-bootstrap`) in `/usr/local/bin` which should be in your path, so you can easily use the binaries from your terminal. The installer also nukes your previous config and keys and sets up a fresh config and downloads the latest bootstrap seed.
to run as client:
$ lokinet -g
$ lokinet-bootstrap
$ sudo lokinet
to run as relay:
$ lokinet -r
$ lokinet-bootstrap
$ sudo lokinet
## Running on Windows
**DO NOT RUN AS ELEVATED USER**, run as normal user.
to run as client, run the `run-lokinet.bat` batch file as your normal user.
## Building ## Building
Build requirements: Build requirements:
@ -33,6 +81,41 @@ install:
$ sudo make install $ sudo make install
### MacOS
build:
make sure you have cmake and xcode command line tools installed
$ git clone https://github.com/loki-project/loki-network
$ cd loki-network
$ make -j8
install:
$ sudo make install
### Windows
build (where `$ARCH` is your platform - `i686` or `x86_64`):
$ pacman -Sy base-devel mingw-w64-$ARCH-toolchain git libtool autoconf mingw-w64-$ARCH-cmake
$ git clone https://github.com/loki-project/loki-network.git
$ cd loki-network
$ mkdir -p build; cd build
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK_RUNTIME=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G 'Unix Makefiles'
install (elevated) to `$PROGRAMFILES/lokinet` or `$ProgramFiles(x86)/lokinet`:
$ make install
if cross-compiling, install mingw-w64 from your distro's package manager, or [build from source](https://sourceforge.net/p/mingw-w64/wiki2/Cross%20Win32%20and%20Win64%20compiler/), then:
$ mkdir -p build; cd build
$ export COMPILER=clang # if using clang for windows
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK_RUNTIME=ON -DCMAKE_CROSSCOMPILING=ON -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake
this will create a static binary that can be installed anywhere, with no other dependency other than libc (minimum v6.1)
### Solaris 2.10+ ### Solaris 2.10+
NOTE: Oracle Solaris users need to download/compile the TAP driver from http://www.whiteboard.ne.jp/~admin2/tuntap/ NOTE: Oracle Solaris users need to download/compile the TAP driver from http://www.whiteboard.ne.jp/~admin2/tuntap/
@ -84,53 +167,3 @@ build:
install (root): install (root):
# gmake install # gmake install
### Windows
build (where `$ARCH` is your platform - `i686` or `x86_64`):
$ pacman -Sy base-devel mingw-w64-$ARCH-toolchain git libtool autoconf mingw-w64-$ARCH-cmake
$ git clone https://github.com/loki-project/loki-network.git
$ cd loki-network
$ mkdir -p build; cd build
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK_RUNTIME=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G 'Unix Makefiles'
install (elevated) to `$PROGRAMFILES/lokinet` or `$ProgramFiles(x86)/lokinet`:
$ make install
if cross-compiling, install mingw-w64 from your distro's package manager, or [build from source](https://sourceforge.net/p/mingw-w64/wiki2/Cross%20Win32%20and%20Win64%20compiler/), then:
$ mkdir -p build; cd build
$ export COMPILER=clang # if using clang for windows
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK_RUNTIME=ON -DCMAKE_CROSSCOMPILING=ON -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake
this will create a static binary that can be installed anywhere, with no other dependency other than libc (minimum v6.1)
## Running on Linux/UNIX/BSD
**DO NOT RUN AS ROOT**, run as normal user.
to run as client:
$ lokinet -g
$ lokinet-bootstrap
$ lokinet
to run as relay:
$ lokinet -r -g
$ lokinet-bootstrap
$ lokinet
## Running on Windows
**DO NOT RUN AS ELEVATED USER**, run as normal user.
to run as client, run the `run-lokinet.bat` batch file as your normal user.
## Usage
see the [documentation](https://loki-project.github.io/loki-docs/Lokinet/LokinetOverview/) on how to get started.

Loading…
Cancel
Save