mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Merge branch 'staging' of ssh://github.com/loki-project/loki-network into staging
This commit is contained in:
commit
ef394cd2fb
274 changed files with 1763 additions and 1880 deletions
193
CMakeLists.txt
193
CMakeLists.txt
|
@ -198,6 +198,7 @@ set(LIB lokinet)
|
|||
set(SHARED_LIB ${LIB}-shared)
|
||||
set(STATIC_LIB ${LIB}-static)
|
||||
set(CRYPTOGRAPHY_LIB ${LIB}-cryptography)
|
||||
set(UTIL_LIB ${LIB}-util)
|
||||
set(PLATFORM_LIB ${LIB}-platform)
|
||||
set(ANDROID_LIB ${LIB}android)
|
||||
set(TT_ROOT vendor/libtuntap-master)
|
||||
|
@ -208,32 +209,32 @@ if(UNIX)
|
|||
add_definitions(-DPOSIX)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
|
||||
set(EV_SRC llarp/ev_epoll.cpp)
|
||||
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c)
|
||||
set(EV_SRC llarp/ev_epoll.cpp)
|
||||
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
||||
set(EV_SRC llarp/ev_kqueue.cpp)
|
||||
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
||||
set(EV_SRC llarp/ev_kqueue.cpp)
|
||||
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
||||
set(EV_SRC llarp/ev_kqueue.cpp)
|
||||
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
||||
set(EV_SRC llarp/ev_kqueue.cpp)
|
||||
set(EV_SRC llarp/ev/ev_kqueue.cpp)
|
||||
# TODO: _actually_ port to solaris/illumos (it's fairly complete...except for TUN) -rick
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
|
||||
set(EV_SRC llarp/ev_epoll.cpp)
|
||||
set(EV_SRC llarp/ev/ev_epoll.cpp)
|
||||
else()
|
||||
message(FATAL_ERROR "Your operating system is not supported yet")
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
elseif(WIN32)
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-windows.c)
|
||||
set(EV_SRC llarp/ev_win32.cpp)
|
||||
set(EV_SRC llarp/ev/ev_win32.cpp)
|
||||
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500)
|
||||
else()
|
||||
message(FATAL_ERROR "What operating system _are_ you building on/for?")
|
||||
|
@ -278,28 +279,41 @@ set(CXX_COMPAT_SRC
|
|||
include_directories(vendor/cppbackport-master/lib)
|
||||
endif(NOT WIN32)
|
||||
|
||||
set(LIB_UTIL_SRC
|
||||
llarp/constants/defaults.cpp
|
||||
llarp/constants/proto.cpp
|
||||
llarp/constants/version.cpp
|
||||
llarp/util/aligned.cpp
|
||||
llarp/util/bencode.cpp
|
||||
llarp/util/bits.cpp
|
||||
llarp/util/buffer.cpp
|
||||
llarp/util/common.cpp
|
||||
llarp/util/encode.cpp
|
||||
llarp/util/endian.cpp
|
||||
llarp/util/fs.cpp
|
||||
llarp/util/ini.cpp
|
||||
llarp/util/logger.c
|
||||
llarp/util/logger.cpp
|
||||
llarp/util/logic.cpp
|
||||
llarp/util/mem.cpp
|
||||
llarp/util/queue_manager.cpp
|
||||
llarp/util/queue.cpp
|
||||
llarp/util/str.cpp
|
||||
llarp/util/string_view.cpp
|
||||
llarp/util/thread_pool.cpp
|
||||
llarp/util/threading.cpp
|
||||
llarp/util/threadpool.cpp
|
||||
llarp/util/time.cpp
|
||||
llarp/util/timer.cpp
|
||||
llarp/util/types.cpp
|
||||
)
|
||||
|
||||
set(LIB_PLATFORM_SRC
|
||||
# string stuff
|
||||
llarp/str.cpp
|
||||
# for outpug
|
||||
llarp/logger.cpp
|
||||
# needed for threading
|
||||
llarp/logic.cpp
|
||||
# for zero (for net.hpp stuff for llarp::addr stuff)
|
||||
llarp/mem.cpp
|
||||
# for networking
|
||||
llarp/ev.cpp
|
||||
llarp/net.cpp
|
||||
llarp/net_addr.cpp
|
||||
llarp/net_inaddr.cpp
|
||||
# for timer
|
||||
llarp/time.cpp
|
||||
# for logic
|
||||
llarp/timer.cpp
|
||||
# for threading
|
||||
llarp/queue_manager.cpp
|
||||
llarp/thread_pool.cpp
|
||||
llarp/threadpool.cpp
|
||||
llarp/ev/ev.cpp
|
||||
llarp/net/net.cpp
|
||||
llarp/net/net_addr.cpp
|
||||
llarp/net/net_inaddr.cpp
|
||||
# for android shim
|
||||
${ANDROID_PLATFORM_SRC}
|
||||
# process isolation implementation
|
||||
|
@ -309,9 +323,9 @@ set(LIB_PLATFORM_SRC
|
|||
# c++17 compat code
|
||||
${CXX_COMPAT_SRC}
|
||||
# win32 inline code
|
||||
llarp/win32_inet.c
|
||||
llarp/win32_intrnl.c
|
||||
llarp/win32_upoll.c
|
||||
llarp/win32/win32_inet.c
|
||||
llarp/win32/win32_intrnl.c
|
||||
llarp/win32/win32_upoll.c
|
||||
)
|
||||
|
||||
set(NTRU_AVX_SRC
|
||||
|
@ -445,11 +459,14 @@ if(WIN32)
|
|||
endif(WIN32)
|
||||
|
||||
set(DNSLIB_SRC
|
||||
llarp/dns/dotlokilookup.cpp
|
||||
llarp/dns/dns.cpp
|
||||
llarp/dns/iptracker.cpp
|
||||
llarp/dns/message.cpp
|
||||
llarp/dns/name.cpp
|
||||
llarp/dns/query.cpp
|
||||
llarp/dns/question.cpp
|
||||
llarp/dns/rectypes.cpp
|
||||
llarp/dns/rr.cpp
|
||||
llarp/dns/serialize.cpp
|
||||
llarp/dns/server.cpp
|
||||
|
@ -462,17 +479,11 @@ set(LIB_SRC
|
|||
${EV_SRC}
|
||||
${UTP_SRC}
|
||||
llarp/address_info.cpp
|
||||
llarp/aligned.cpp
|
||||
llarp/bencode.cpp
|
||||
llarp/bits.cpp
|
||||
llarp/buffer.cpp
|
||||
llarp/codel.cpp
|
||||
llarp/common.cpp
|
||||
llarp/config.cpp
|
||||
llarp/context.cpp
|
||||
llarp/crypto.cpp
|
||||
llarp/crypto_libsodium.cpp
|
||||
llarp/defaults.cpp
|
||||
llarp/dht.cpp
|
||||
llarp/dht/bucket.cpp
|
||||
llarp/dht/context.cpp
|
||||
|
@ -494,18 +505,12 @@ set(LIB_SRC
|
|||
llarp/dht/node.cpp
|
||||
llarp/dht/publish_intro.cpp
|
||||
llarp/dns.cpp
|
||||
llarp/dns_dotlokilookup.cpp
|
||||
llarp/dns_iptracker.cpp
|
||||
llarp/dns_rectypes.cpp
|
||||
llarp/dnsc.cpp
|
||||
llarp/dnsd.cpp
|
||||
llarp/encode.cpp
|
||||
llarp/encrypted.cpp
|
||||
llarp/encrypted_ack.cpp
|
||||
llarp/encrypted_frame.cpp
|
||||
llarp/endian.cpp
|
||||
llarp/establish_job.cpp
|
||||
llarp/exit.cpp
|
||||
llarp/exit/close_exit.cpp
|
||||
llarp/exit/context.cpp
|
||||
llarp/exit/endpoint.cpp
|
||||
|
@ -517,12 +522,9 @@ set(LIB_SRC
|
|||
llarp/exit/transfer_traffic.cpp
|
||||
llarp/exit/update_exit.cpp
|
||||
llarp/exit_info.cpp
|
||||
llarp/exit_route.cpp
|
||||
llarp/fs.cpp
|
||||
llarp/handlers/exit.cpp
|
||||
llarp/handlers/null.cpp
|
||||
llarp/handlers/tun.cpp
|
||||
llarp/ini.cpp
|
||||
llarp/ip.cpp
|
||||
llarp/link/curvecp.cpp
|
||||
llarp/link/encoder.cpp
|
||||
|
@ -533,7 +535,6 @@ set(LIB_SRC
|
|||
llarp/link_intro.cpp
|
||||
llarp/link_layer.cpp
|
||||
llarp/link_message.cpp
|
||||
llarp/messages.cpp
|
||||
llarp/messages/dht.cpp
|
||||
llarp/messages/dht_immediate.cpp
|
||||
llarp/messages/discard.cpp
|
||||
|
@ -545,17 +546,15 @@ set(LIB_SRC
|
|||
llarp/messages/relay.cpp
|
||||
llarp/messages/relay_commit.cpp
|
||||
llarp/messages/transfer_traffic.cpp
|
||||
llarp/net_int.cpp
|
||||
llarp/net/net_int.cpp
|
||||
llarp/nodedb.cpp
|
||||
llarp/path.cpp
|
||||
llarp/path_types.cpp
|
||||
llarp/pathbuilder.cpp
|
||||
llarp/pathset.cpp
|
||||
llarp/path/path.cpp
|
||||
llarp/path/path_types.cpp
|
||||
llarp/path/pathbuilder.cpp
|
||||
llarp/path/pathset.cpp
|
||||
llarp/pow.cpp
|
||||
llarp/profiling.cpp
|
||||
llarp/proofofwork.cpp
|
||||
llarp/proto.cpp
|
||||
llarp/queue.cpp
|
||||
llarp/relay_commit.cpp
|
||||
llarp/relay_up_down.cpp
|
||||
llarp/router.cpp
|
||||
|
@ -570,7 +569,6 @@ set(LIB_SRC
|
|||
llarp/routing/path_transfer.cpp
|
||||
llarp/routing_endpoint.cpp
|
||||
llarp/rpc.cpp
|
||||
llarp/service.cpp
|
||||
llarp/service/Identity.cpp
|
||||
llarp/service/Intro.cpp
|
||||
llarp/service/IntroSet.cpp
|
||||
|
@ -585,12 +583,8 @@ set(LIB_SRC
|
|||
llarp/service/tag.cpp
|
||||
llarp/service/types.cpp
|
||||
llarp/service/vanity.cpp
|
||||
llarp/string_view.cpp
|
||||
llarp/testnet.c
|
||||
llarp/threading.cpp
|
||||
llarp/transit_hop.cpp
|
||||
llarp/types.cpp
|
||||
llarp/version.cpp
|
||||
)
|
||||
|
||||
set(RC_SRC
|
||||
|
@ -604,34 +598,34 @@ set(DNS_SRC
|
|||
llarp/dns_iptracker.cpp
|
||||
llarp/dns_dotlokilookup.cpp
|
||||
llarp/dns_rectypes.cpp
|
||||
llarp/net.cpp
|
||||
llarp/net/net.cpp
|
||||
daemon/dns.cpp
|
||||
)
|
||||
|
||||
set(TEST_SRC
|
||||
test/base32_unittest.cpp
|
||||
test/dht_unittest.cpp
|
||||
test/encrypted_frame_unittest.cpp
|
||||
test/exit_unittest.cpp
|
||||
test/hiddenservice_unittest.cpp
|
||||
test/dht/test_llarp_dht_key.cpp
|
||||
test/dht/test_llarp_dht.cpp
|
||||
test/dns/test_llarp_dns_dns.cpp
|
||||
test/exit/test_llarp_exit_context.cpp
|
||||
test/link/test_llarp_link.cpp
|
||||
test/main.cpp
|
||||
test/net_unittest.cpp
|
||||
test/obtain_exit_unittest.cpp
|
||||
test/pq_unittest.cpp
|
||||
test/net_unittest.cpp
|
||||
test/link_layer_unittest.cpp
|
||||
test/test_dns_unit.cpp
|
||||
test/test_dnsc_unit.cpp
|
||||
test/test_dnsd_unit.cpp
|
||||
test/test_dnslib.cpp
|
||||
test/test_llarp_aligned.cpp
|
||||
test/test_llarp_dht_key.cpp
|
||||
test/test_llarp_queue_manager.cpp
|
||||
test/test_llarp_queue.cpp
|
||||
test/test_llarp_thread_pool.cpp
|
||||
test/test_router_contact.cpp
|
||||
test/test_service_address.cpp
|
||||
test/traffic_transfer_unittest.cpp
|
||||
test/net/test_llarp_net_inaddr.cpp
|
||||
test/net/test_llarp_net.cpp
|
||||
test/routing/llarp_routing_transfer_traffic.cpp
|
||||
test/routing/test_llarp_routing_obtainexitmessage.cpp
|
||||
test/service/test_llarp_service_address.cpp
|
||||
test/service/test_llarp_service_identity.cpp
|
||||
test/test_llarp_crypto.cpp
|
||||
test/test_llarp_dns.cpp
|
||||
test/test_llarp_dnsd.cpp
|
||||
test/test_llarp_encrypted_frame.cpp
|
||||
test/test_llarp_router_contact.cpp
|
||||
test/util/test_llarp_util_aligned.cpp
|
||||
test/util/test_llarp_util_bencode.cpp
|
||||
test/util/test_llarp_util_encode.cpp
|
||||
test/util/test_llarp_util_queue_manager.cpp
|
||||
test/util/test_llarp_util_queue.cpp
|
||||
test/util/test_llarp_util_thread_pool.cpp
|
||||
)
|
||||
|
||||
set(TEST_EXE testAll)
|
||||
|
@ -669,12 +663,12 @@ if(USE_LIBABYSS)
|
|||
add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp)
|
||||
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(${ABYSS_EXE} ${PLATFORM_LIB})
|
||||
target_link_libraries(${ABYSS_EXE} ${UTIL_LIB} ${PLATFORM_LIB})
|
||||
else()
|
||||
target_link_libraries(${ABYSS_EXE} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
target_link_libraries(${ABYSS_EXE} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
endif(NOT WIN32)
|
||||
|
||||
set(TEST_SRC ${TEST_SRC} test/jsonrpc_unittest.cpp)
|
||||
set(TEST_SRC ${TEST_SRC} test/test_libabyss.cpp)
|
||||
# for freebsd
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
include_directories(/usr/local/include)
|
||||
|
@ -713,11 +707,12 @@ endif(NOT WIN32)
|
|||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
||||
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
||||
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
|
||||
if(USE_LIBABYSS)
|
||||
target_link_libraries(${PLATFORM_LIB} Threads::Threads ${ABYSS_LIB})
|
||||
target_link_libraries(${PLATFORM_LIB} ${UTIL_LIB} Threads::Threads ${ABYSS_LIB})
|
||||
else()
|
||||
target_link_libraries(${PLATFORM_LIB} Threads::Threads)
|
||||
target_link_libraries(${PLATFORM_LIB} ${UTIL_LIB} Threads::Threads)
|
||||
endif(USE_LIBABYSS)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
if(NON_PC_TARGET)
|
||||
|
@ -726,20 +721,14 @@ endif(NOT WIN32)
|
|||
target_link_libraries(${PLATFORM_LIB} -lcap)
|
||||
endif(NON_PC_TARGET)
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
target_link_libraries(${STATIC_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${PLATFORM_LIB})
|
||||
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
|
||||
#target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
|
||||
#target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB})
|
||||
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${PLATFORM_LIB})
|
||||
#target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB})
|
||||
target_link_libraries(${STATIC_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB})
|
||||
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB})
|
||||
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB})
|
||||
if (WIN32)
|
||||
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
#target_link_libraries(${CLIENT_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
#target_link_libraries(${RC_EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
#target_link_libraries(${DNS_EXE} ${STATIC_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
target_link_libraries(${EXE} ${STATIC_LINK_LIBS} ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
target_link_libraries(${TEST_EXE} ${STATIC_LINK_LIBS} gtest_main ${STATIC_LIB} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
|
||||
if(ANDROID)
|
||||
add_library(${ANDROID_LIB} SHARED jni/lokinet_android.cpp)
|
||||
|
@ -748,10 +737,6 @@ endif(NOT WIN32)
|
|||
|
||||
if(WITH_SHARED)
|
||||
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
|
||||
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${PLATFORM_LIB} Threads::Threads)
|
||||
#target_link_libraries(${EXE} ${SHARED_LIB})
|
||||
#target_link_libraries(${TEST_EXE} ${SHARED_LIB})
|
||||
#target_link_libraries(${RC_EXE} ${SHARED_LIB})
|
||||
#target_link_libraries(${DNS_EXE} ${SHARED_LIB} Threads::Threads)
|
||||
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB} Threads::Threads)
|
||||
endif(WITH_SHARED)
|
||||
endif(SHADOW)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include <config.hpp> // for ensure_config
|
||||
#include <fs.hpp>
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <llarp.h>
|
||||
#include <logger.hpp>
|
||||
#include <util/fs.hpp>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#define LLARP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <ev.h>
|
||||
#include <mem.h>
|
||||
#include <logic.hpp>
|
||||
#include <version.hpp>
|
||||
#include <constants/version.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <handlers/tun.hpp> // for handlers
|
||||
#include <service/address.hpp> // for service::address
|
||||
#include <service/endpoint.hpp>
|
||||
#include <util/logic.hpp>
|
||||
#include <util/mem.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#ifndef LLARP_HPP
|
||||
#define LLARP_HPP
|
||||
|
||||
#include <crypto.h>
|
||||
#include <llarp.h>
|
||||
#include <threading.hpp>
|
||||
#include <crypto.hpp>
|
||||
#include <util/threading.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
@ -12,9 +11,16 @@
|
|||
|
||||
struct llarp_config;
|
||||
struct llarp_config_iterator;
|
||||
struct llarp_ev_loop;
|
||||
struct llarp_nodedb;
|
||||
struct llarp_nodedb_iter;
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
class Logic;
|
||||
struct Router;
|
||||
struct RouterContact;
|
||||
|
||||
struct Context
|
||||
{
|
||||
~Context();
|
||||
|
@ -40,7 +46,7 @@ namespace llarp
|
|||
LoadDatabase();
|
||||
|
||||
int
|
||||
IterateDatabase(struct llarp_nodedb_iter i);
|
||||
IterateDatabase(llarp_nodedb_iter &i);
|
||||
|
||||
bool
|
||||
PutDatabase(struct llarp::RouterContact &rc);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef LLARP_STRING_H
|
||||
#define LLARP_STRING_H
|
||||
|
||||
#include <common.hpp>
|
||||
#include <util/common.hpp>
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
#if !(__APPLE__ && __MACH__)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define __ABYSS_CLIENT_HPP__
|
||||
|
||||
#include <abyss/json.hpp>
|
||||
#include <ev.h>
|
||||
#include <string_view.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <util/string_view.hpp>
|
||||
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __ABYSS_HTTP_HPP__
|
||||
#define __ABYSS_HTTP_HPP__
|
||||
#include <abyss/json.hpp>
|
||||
#include <string_view.hpp>
|
||||
#include <util/string_view.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#define __ABYSS_SERVER_HPP__
|
||||
|
||||
#include <abyss/json.hpp>
|
||||
#include <ev.h>
|
||||
#include <logic.hpp>
|
||||
#include <string_view.hpp>
|
||||
#include <time.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <util/logic.hpp>
|
||||
#include <util/string_view.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <libabyss.hpp>
|
||||
#include <net.hpp>
|
||||
#include <net/net.hpp>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/signal.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <abyss/client.hpp>
|
||||
#include <abyss/http.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <crypto.hpp>
|
||||
#include <buffer.hpp>
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
namespace abyss
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <abyss/json.hpp>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/writer.h>
|
||||
#include <string_view.hpp>
|
||||
#include <util/string_view.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include <abyss/http.hpp>
|
||||
#include <abyss/server.hpp>
|
||||
#include <buffer.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <time.hpp>
|
||||
|
||||
#include <abyss/http.hpp>
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <bencode.h>
|
||||
#include <mem.h>
|
||||
#include <net/net.hpp>
|
||||
#include <util/bencode.h>
|
||||
#include <util/mem.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <net.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#ifndef LLARP_AI_HPP
|
||||
#define LLARP_AI_HPP
|
||||
|
||||
#include <bencode.hpp>
|
||||
#include <crypto.h>
|
||||
#include <crypto.hpp>
|
||||
#include <mem.h>
|
||||
#include <net.h>
|
||||
#include <net/net.h>
|
||||
#include <util/bencode.hpp>
|
||||
#include <util/mem.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <aligned.hpp>
|
|
@ -1 +0,0 @@
|
|||
#include <bits.hpp>
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef LLARP_CODEL_QUEUE_HPP
|
||||
#define LLARP_CODEL_QUEUE_HPP
|
||||
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <threading.hpp>
|
||||
#include <time.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <util/mem.hpp>
|
||||
#include <util/threading.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <common.hpp>
|
|
@ -1,11 +1,12 @@
|
|||
#include <config.h>
|
||||
#include <config.hpp>
|
||||
#include <defaults.hpp>
|
||||
#include <fs.hpp>
|
||||
#include <ini.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <net.hpp>
|
||||
|
||||
#include <constants/defaults.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <util/fs.hpp>
|
||||
#include <util/ini.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <util/mem.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
@ -140,7 +141,7 @@ llarp_generic_ensure_config(std::ofstream &f, std::string basepath)
|
|||
f << "bind=127.0.0.1:1190" << std::endl;
|
||||
f << std::endl << std::endl;
|
||||
|
||||
f << "# system settings for priviledges and such" << std::endl;
|
||||
f << "# system settings for privileges and such" << std::endl;
|
||||
f << "[system]" << std::endl;
|
||||
#ifdef _WIN32
|
||||
f << "# ";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LIBLLARP_CONFIG_HPP
|
||||
#define LIBLLARP_CONFIG_HPP
|
||||
#ifndef LLARP_CONFIG_HPP
|
||||
#define LLARP_CONFIG_HPP
|
||||
#include <config.h>
|
||||
|
||||
#include <list>
|
||||
|
|
1
llarp/constants/defaults.cpp
Normal file
1
llarp/constants/defaults.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include <constants/defaults.hpp>
|
1
llarp/constants/proto.cpp
Normal file
1
llarp/constants/proto.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include <constants/proto.hpp>
|
|
@ -1,3 +1,3 @@
|
|||
#include <version.hpp>
|
||||
#include <constants/version.hpp>
|
||||
|
||||
const char Version::LLARP_NET_ID[] = "testnet";
|
|
@ -1,11 +1,15 @@
|
|||
#include <dns_dotlokilookup.hpp>
|
||||
#include <dnsd.hpp>
|
||||
#include <ev.hpp>
|
||||
#include <getopt.h>
|
||||
#include <llarp.h>
|
||||
#include <llarp.hpp>
|
||||
#include <logger.h>
|
||||
#include <llarp.h>
|
||||
|
||||
#include <dht/context.hpp>
|
||||
#include <dns/dotlokilookup.hpp>
|
||||
#include <dnsd.hpp>
|
||||
#include <ev/ev.hpp>
|
||||
#include <nodedb.hpp>
|
||||
#include <router.hpp>
|
||||
#include <util/logger.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/param.h> // for MIN
|
||||
|
@ -103,7 +107,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
int
|
||||
Context::IterateDatabase(struct llarp_nodedb_iter i)
|
||||
Context::IterateDatabase(llarp_nodedb_iter &i)
|
||||
{
|
||||
return nodedb->iterate_all(i);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include <crypto.hpp>
|
||||
|
||||
#include <util/buffer.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <buffer.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef LLARP_CRYPTO_H_
|
||||
#define LLARP_CRYPTO_H_
|
||||
#ifdef __cplusplus
|
||||
#include "crypto.hpp"
|
||||
#endif
|
||||
#endif
|
|
@ -1,19 +1,19 @@
|
|||
#ifndef LLARP_CRYPTO_HPP
|
||||
#define LLARP_CRYPTO_HPP
|
||||
|
||||
#include <aligned.hpp>
|
||||
#include <mem.h>
|
||||
#include <router_id.hpp>
|
||||
#include <threadpool.h>
|
||||
#include <buffer.h>
|
||||
#include <common.hpp>
|
||||
#include <util/aligned.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/common.hpp>
|
||||
#include <util/mem.h>
|
||||
#include <util/threadpool.h>
|
||||
|
||||
#include <functional>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* crypto.h
|
||||
* crypto.hpp
|
||||
*
|
||||
* libsodium abstraction layer
|
||||
* potentially allow libssl support in the future
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <assert.h>
|
||||
#include <crypto.h>
|
||||
#include <crypto.hpp>
|
||||
#include <sodium/crypto_generichash.h>
|
||||
#include <sodium/crypto_sign.h>
|
||||
#include <sodium/crypto_scalarmult.h>
|
||||
#include <sodium/crypto_stream_xchacha20.h>
|
||||
#include <crypto.hpp>
|
||||
#include "mem.hpp"
|
||||
#include <util/mem.hpp>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <defaults.hpp>
|
|
@ -2,8 +2,8 @@
|
|||
#define LLARP_DHT_H_
|
||||
|
||||
#include <crypto.hpp>
|
||||
#include <buffer.h>
|
||||
#include <router_contact.hpp>
|
||||
#include <util/buffer.h>
|
||||
|
||||
/**
|
||||
* dht.h
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#include <dht/context.hpp>
|
||||
#include <dht/key.hpp>
|
||||
#include <dht/message.hpp>
|
||||
#include <dht/messages/all.hpp>
|
||||
#include <dht/node.hpp>
|
|
@ -8,7 +8,7 @@
|
|||
#include <dht/messages/findintro.hpp>
|
||||
#include <dht/node.hpp>
|
||||
#include <service/IntroSet.hpp>
|
||||
#include <time.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef LLARP_DHT_KEY_HPP
|
||||
#define LLARP_DHT_KEY_HPP
|
||||
|
||||
#include <aligned.hpp>
|
||||
#include <util/aligned.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef LLARP_DHT_MESSAGE_HPP
|
||||
#define LLARP_DHT_MESSAGE_HPP
|
||||
|
||||
#include <bencode.hpp>
|
||||
#include <dht.h>
|
||||
#include <dht/key.hpp>
|
||||
#include <path_types.hpp>
|
||||
#include <path/path_types.hpp>
|
||||
#include <util/bencode.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace llarp
|
|||
{
|
||||
constexpr size_t MAX_MSG_SIZE = 2048;
|
||||
|
||||
struct IMessage : public llarp::IBEncodeMessage
|
||||
struct IMessage : public IBEncodeMessage
|
||||
{
|
||||
virtual ~IMessage(){};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <dnsd.hpp> // for llarp_handle_dnsd_recvfrom, dnsc
|
||||
#include <endian.hpp>
|
||||
#include <logger.hpp>
|
||||
|
||||
#include <util/endian.hpp>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
void
|
||||
hexDump(const char *buffer, uint16_t size)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LIBLLARP_DNS_HPP
|
||||
#define LIBLLARP_DNS_HPP
|
||||
#ifndef LLARP_DNS_HPP
|
||||
#define LLARP_DNS_HPP
|
||||
|
||||
#include <dns.h>
|
||||
#include <sys/types.h> // for uint & ssize_t
|
||||
|
@ -8,8 +8,8 @@
|
|||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <dns_rectypes.hpp>
|
||||
#include <dns/rectypes.hpp>
|
||||
#include <net/net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -23,6 +23,7 @@
|
|||
#define LLARP_DNS_RECTYPE_MX 15
|
||||
#define LLARP_DNS_RECTYPE_TXT 16
|
||||
|
||||
struct dnsc_answer_request;
|
||||
struct dnsd_context;
|
||||
|
||||
// dnsc can work over any UDP socket
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
#ifndef LLARP_DNS_DNS_HPP
|
||||
#define LLARP_DNS_DNS_HPP
|
||||
#include <dns/name.hpp>
|
||||
#include <dns/rr.hpp>
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/message.hpp>
|
||||
#include <dns/server.hpp>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <dns_dotlokilookup.hpp>
|
||||
#include <dns/dotlokilookup.hpp>
|
||||
|
||||
#include <handlers/tun.hpp>
|
||||
#include <logic.hpp>
|
||||
#include <service/context.hpp>
|
||||
#include <util/logic.hpp>
|
||||
|
||||
std::string const default_chars =
|
||||
"abcdefghijklmnaoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LIBLLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
#define LIBLLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
#ifndef LLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
#define LLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
|
||||
#include <dnsd.hpp>
|
||||
#include <service/address.hpp>
|
|
@ -1,4 +1,4 @@
|
|||
#include <dns_iptracker.hpp>
|
||||
#include <dns/iptracker.hpp>
|
||||
|
||||
dns_iptracker g_dns_iptracker;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef LIBLLARP_DNSIPTRACKER_HPP
|
||||
#define LIBLLARP_DNSIPTRACKER_HPP
|
||||
#ifndef LLARP_DNSIPTRACKER_HPP
|
||||
#define LLARP_DNSIPTRACKER_HPP
|
||||
|
||||
#include <dns_dotlokilookup.hpp>
|
||||
#include <net.hpp>
|
||||
#include <dns/dotlokilookup.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <service/address.hpp>
|
||||
|
||||
#include <map>
|
|
@ -1,7 +1,9 @@
|
|||
#include <buffer.hpp>
|
||||
#include <dns/message.hpp>
|
||||
|
||||
#include <dns/dns.hpp>
|
||||
#include <endian.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/endian.hpp>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef LLARP_DNS_MESSAGE_HPP
|
||||
#define LLARP_DNS_MESSAGE_HPP
|
||||
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/rr.hpp>
|
||||
#include <dns/question.hpp>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <dns/name.hpp>
|
||||
#include <net.hpp>
|
||||
#include <net/net.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef LLARP_DNS_NAME_HPP
|
||||
#define LLARP_DNS_NAME_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
#include <net_int.hpp>
|
||||
#include <net/net_int.hpp>
|
||||
#include <util/buffer.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <dns/question.hpp>
|
||||
#include <logger.hpp>
|
||||
|
||||
#include <util/logger.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/name.hpp>
|
||||
#include <net_int.hpp>
|
||||
#include <net/net_int.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <dns.hpp> // for vput16bits()
|
||||
#include <dns_rectypes.hpp>
|
||||
#include <dns/rectypes.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
|
@ -1,8 +1,9 @@
|
|||
#ifndef LIBLLARP_DNS_REC_TYPES_HPP
|
||||
#define LIBLLARP_DNS_REC_TYPES_HPP
|
||||
#ifndef LLARP_DNS_REC_TYPES_HPP
|
||||
#define LLARP_DNS_REC_TYPES_HPP
|
||||
|
||||
#include <net/net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <util/buffer.h> // for byte_t
|
||||
|
||||
#include <buffer.h> // for byte_t
|
||||
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
|
@ -1,5 +1,6 @@
|
|||
#include <dns/rr.hpp>
|
||||
#include <logger.hpp>
|
||||
|
||||
#include <util/logger.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <dns/name.hpp>
|
||||
#include <dns/serialize.hpp>
|
||||
#include <net_int.hpp>
|
||||
#include <net/net_int.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <dns/serialize.hpp>
|
||||
#include <net_int.hpp>
|
||||
#include <net/net_int.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef LLARP_DNS_SERIALIZE_HPP
|
||||
#define LLARP_DNS_SERIALIZE_HPP
|
||||
#include <buffer.h>
|
||||
|
||||
#include <util/buffer.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#define LLARP_DNS_SERVER_HPP
|
||||
|
||||
#include <dns/message.hpp>
|
||||
#include <ev.h>
|
||||
#include <net.hpp>
|
||||
#include <string_view.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <net/net.hpp>
|
||||
#include <util/string_view.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <dnsc.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <net.hpp> // for llarp::Addr
|
||||
#include <net/net.hpp> // for llarp::Addr
|
||||
#include <util/logger.hpp>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef LIBLLARP_DNSC_HPP
|
||||
#define LIBLLARP_DNSC_HPP
|
||||
#ifndef LLARP_DNSC_HPP
|
||||
#define LLARP_DNSC_HPP
|
||||
|
||||
#include <ev.h> // for sockaadr
|
||||
#include <dns.hpp> // get protocol structs
|
||||
#include <ev/ev.h> // for sockaadr
|
||||
|
||||
// internal, non-public functions
|
||||
// well dnsc init/stop are public...
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <dnsd.hpp>
|
||||
#include <net.hpp>
|
||||
#include <net/net.hpp>
|
||||
|
||||
extern dns_tracker dns_udp_tracker;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef LIBLLARP_DNSD_HPP
|
||||
#define LIBLLARP_DNSD_HPP
|
||||
#ifndef LLARP_DNSD_HPP
|
||||
#define LLARP_DNSD_HPP
|
||||
|
||||
#include <ev.h> // for sockaadr
|
||||
#include <dns.hpp> // question and dnsc
|
||||
#include <dnsc.hpp>
|
||||
#include <ev/ev.h> // for sockaadr
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
#include <encrypted.hpp>
|
||||
#include <mem.hpp>
|
||||
namespace llarp
|
||||
{
|
||||
} // namespace llarp
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef LLARP_ENCCRYPTED_HPP
|
||||
#define LLARP_ENCCRYPTED_HPP
|
||||
|
||||
#include <aligned.hpp>
|
||||
#include <bencode.h>
|
||||
#include <buffer.h>
|
||||
#include <mem.hpp>
|
||||
#include <link_layer.hpp>
|
||||
#include <util/aligned.hpp>
|
||||
#include <util/bencode.h>
|
||||
#include <util/buffer.h>
|
||||
#include <util/mem.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <crypto.hpp>
|
||||
#include <encrypted_frame.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
|
||||
#include <crypto.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <util/mem.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef LLARP_ENCRYPTED_FRAME_HPP
|
||||
#define LLARP_ENCRYPTED_FRAME_HPP
|
||||
|
||||
#include <crypto.h>
|
||||
#include <crypto.hpp>
|
||||
#include <encrypted.hpp>
|
||||
#include <buffer.hpp>
|
||||
#include <mem.h>
|
||||
#include <threadpool.h>
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/mem.h>
|
||||
#include <util/threadpool.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <endian.hpp>
|
|
@ -1,18 +1,18 @@
|
|||
#include <ev.h>
|
||||
#include <logic.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <string_view.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <util/logic.hpp>
|
||||
#include <util/mem.hpp>
|
||||
#include <util/string_view.hpp>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// apparently current Solaris will emulate epoll.
|
||||
#if __linux__ || __sun__
|
||||
#include "ev_epoll.hpp"
|
||||
#include <ev/ev_epoll.hpp>
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|
||||
|| (__APPLE__ && __MACH__)
|
||||
#include "ev_kqueue.hpp"
|
||||
#include <ev/ev_kqueue.hpp>
|
||||
#elif defined(_WIN32) || defined(_WIN64) || defined(__NT__)
|
||||
#include "ev_win32.hpp"
|
||||
#include <ev/ev_win32.hpp>
|
||||
#else
|
||||
#error No async event loop for your platform, subclass llarp_ev_loop
|
||||
#endif
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef LLARP_EV_H
|
||||
#define LLARP_EV_H
|
||||
|
||||
#include <buffer.h>
|
||||
#include <time.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/time.hpp>
|
||||
#include <tuntap.h>
|
||||
|
||||
#ifdef _WIN32
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef LLARP_EV_HPP
|
||||
#define LLARP_EV_HPP
|
||||
|
||||
#include <ev.h>
|
||||
#include <ev/ev.h>
|
||||
#include <codel.hpp>
|
||||
#include <threading.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/threading.hpp>
|
||||
|
||||
// writev
|
||||
#ifndef _WIN32
|
||||
|
@ -11,14 +12,13 @@
|
|||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <buffer.h>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <win32_up.h>
|
||||
#include <win32_upoll.h>
|
||||
#include <win32/win32_up.h>
|
||||
#include <win32/win32_upoll.h>
|
||||
// From the preview SDK, should take a look at that
|
||||
// periodically in case its definition changes
|
||||
#define UNIX_PATH_MAX 108
|
1
llarp/ev/ev_epoll.cpp
Normal file
1
llarp/ev/ev_epoll.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include <ev/ev_epoll.hpp>
|
|
@ -1,20 +1,22 @@
|
|||
#ifndef EV_EPOLL_HPP
|
||||
#define EV_EPOLL_HPP
|
||||
|
||||
#include <ev/ev.hpp>
|
||||
#include <net/net.h>
|
||||
#include <net/net.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <util/mem.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <fcntl.h>
|
||||
#include <buffer.h>
|
||||
#include <net.h>
|
||||
#include <signal.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/un.h>
|
||||
#include <tuntap.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <buffer.hpp>
|
||||
#include <ev.hpp>
|
||||
#include <net.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#ifdef ANDROID
|
||||
/** TODO: correct this value */
|
||||
|
@ -23,7 +25,7 @@
|
|||
|
||||
namespace llarp
|
||||
{
|
||||
int
|
||||
inline int
|
||||
tcp_conn::read(byte_t* buf, size_t sz)
|
||||
{
|
||||
if(_shouldClose)
|
||||
|
@ -45,14 +47,14 @@ namespace llarp
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
inline void
|
||||
tcp_conn::flush_write()
|
||||
{
|
||||
connected();
|
||||
ev_io::flush_write();
|
||||
}
|
||||
|
||||
ssize_t
|
||||
inline ssize_t
|
||||
tcp_conn::do_write(void* buf, size_t sz)
|
||||
{
|
||||
if(_shouldClose)
|
||||
|
@ -63,7 +65,7 @@ namespace llarp
|
|||
return ::send(fd, buf, sz, MSG_NOSIGNAL); // ignore sigpipe
|
||||
}
|
||||
|
||||
void
|
||||
inline void
|
||||
tcp_conn::connect()
|
||||
{
|
||||
socklen_t slen = sizeof(sockaddr_in);
|
||||
|
@ -92,7 +94,7 @@ namespace llarp
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
inline int
|
||||
tcp_serv::read(byte_t*, size_t)
|
||||
{
|
||||
int new_fd = ::accept(fd, nullptr, nullptr);
|
1
llarp/ev/ev_kqueue.cpp
Normal file
1
llarp/ev/ev_kqueue.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include <ev/ev_kqueue.hpp>
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef EV_KQUEUE_HPP
|
||||
#define EV_KQUEUE_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
#include <ev.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <net.h>
|
||||
#include <net.hpp>
|
||||
#include <ev/ev.hpp>
|
||||
#include <net/net.h>
|
||||
#include <net/net.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
#include <sys/un.h>
|
||||
|
1
llarp/ev/ev_win32.cpp
Normal file
1
llarp/ev/ev_win32.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include <ev/ev_win32.hpp>
|
|
@ -2,10 +2,10 @@
|
|||
#define EV_WIN32_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
#include <ev.hpp>
|
||||
#include <logger.hpp>
|
||||
#include <net.h>
|
||||
#include <net.hpp>
|
||||
#include <ev/ev.hpp>
|
||||
#include <util/logger.hpp>
|
||||
#include <net/net.h>
|
||||
#include <net/net.hpp>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
#include <ev_kqueue.hpp>
|
|
@ -1 +0,0 @@
|
|||
#include <ev_win32.hpp>
|
|
@ -1 +0,0 @@
|
|||
#include <exit.hpp>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef LLARP_EXIT_HPP
|
||||
#define LLARP_EXIT_HPP
|
||||
#include <exit/context.hpp>
|
||||
#include <exit/policy.hpp>
|
||||
#include <exit/session.hpp>
|
||||
#endif
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include <crypto.hpp>
|
||||
#include <ip.hpp>
|
||||
#include <path.hpp>
|
||||
#include <time.hpp>
|
||||
#include <path/path.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef LLARP_EXIT_POLICY_HPP
|
||||
#define LLARP_EXIT_POLICY_HPP
|
||||
|
||||
#include <bencode.hpp>
|
||||
#include <util/bencode.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <exit/session.hpp>
|
||||
#include <path.hpp>
|
||||
#include <path/path.hpp>
|
||||
#include <router.hpp>
|
||||
|
||||
namespace llarp
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <ip.hpp>
|
||||
#include <messages/exit.hpp>
|
||||
#include <messages/transfer_traffic.hpp>
|
||||
#include <pathbuilder.hpp>
|
||||
#include <path/pathbuilder.hpp>
|
||||
|
||||
#include <deque>
|
||||
#include <queue>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <endian.hpp>
|
||||
#include <messages/transfer_traffic.hpp>
|
||||
|
||||
#include <routing/handler.hpp>
|
||||
#include <util/endian.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <bencode.h>
|
||||
#include <exit_info.hpp>
|
||||
#include <mem.h>
|
||||
#include <string.h>
|
||||
#include <util/bencode.h>
|
||||
#include <util/mem.h>
|
||||
|
||||
#include <list>
|
||||
#include <string.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
#ifndef LLARP_XI_H
|
||||
#define LLARP_XI_H
|
||||
|
||||
#include <buffer.h>
|
||||
#include <crypto.h>
|
||||
#include <net.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <bits.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* exit_info.h
|
||||
*
|
||||
* utilities for handling exits on the llarp network
|
||||
*/
|
||||
|
||||
struct llarp_xi;
|
||||
|
||||
bool
|
||||
llarp_xi_bdecode(struct llarp_xi *xi, llarp_buffer_t *buf);
|
||||
bool
|
||||
llarp_xi_bencode(const struct llarp_xi *xi, llarp_buffer_t *buf);
|
||||
|
||||
/// Exit info model
|
||||
struct llarp_xi
|
||||
{
|
||||
struct in6_addr address;
|
||||
struct in6_addr netmask;
|
||||
byte_t pubkey[PUBKEYSIZE];
|
||||
|
||||
#ifdef __cplusplus
|
||||
bool
|
||||
BEncode(llarp_buffer_t *buf) const
|
||||
{
|
||||
return llarp_xi_bencode(this, buf);
|
||||
}
|
||||
|
||||
bool
|
||||
BDecode(llarp_buffer_t *buf)
|
||||
{
|
||||
return llarp_xi_bdecode(this, buf);
|
||||
}
|
||||
|
||||
friend std::ostream &
|
||||
operator<<(std::ostream &out, const llarp_xi &xi)
|
||||
{
|
||||
char tmp[128] = {0};
|
||||
if(inet_ntop(AF_INET6, (void *)&xi.address, tmp, sizeof(tmp)))
|
||||
out << std::string(tmp);
|
||||
else
|
||||
return out;
|
||||
out << std::string("/");
|
||||
return out << std::to_string(
|
||||
llarp::bits::count_array_bits(xi.netmask.s6_addr));
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct llarp_xi_list;
|
||||
|
||||
struct llarp_xi_list *
|
||||
llarp_xi_list_new();
|
||||
|
||||
void
|
||||
llarp_xi_list_free(struct llarp_xi_list *l);
|
||||
|
||||
bool
|
||||
llarp_xi_list_bdecode(struct llarp_xi_list *l, llarp_buffer_t *buf);
|
||||
|
||||
bool
|
||||
llarp_xi_list_bencode(struct llarp_xi_list *l, llarp_buffer_t *buf);
|
||||
|
||||
void
|
||||
llarp_xi_list_pushback(struct llarp_xi_list *l, struct llarp_xi *xi);
|
||||
|
||||
void
|
||||
llarp_xi_list_copy(struct llarp_xi_list *dst, struct llarp_xi_list *src);
|
||||
|
||||
size_t
|
||||
llarp_xi_list_size(const struct llarp_xi_list *l);
|
||||
|
||||
void
|
||||
llarp_xi_copy(struct llarp_xi *dst, struct llarp_xi *src);
|
||||
|
||||
struct llarp_xi_list_iter
|
||||
{
|
||||
void *user;
|
||||
struct llarp_xi_list *list;
|
||||
bool (*visit)(struct llarp_xi_list_iter *, struct llarp_xi *);
|
||||
};
|
||||
|
||||
void
|
||||
llarp_xi_list_iterate(struct llarp_xi_list *l, struct llarp_xi_list_iter *iter);
|
||||
|
||||
#endif
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef LLARP_XI_HPP
|
||||
#define LLARP_XI_HPP
|
||||
|
||||
#include <bencode.hpp>
|
||||
#include <bits.hpp>
|
||||
#include <crypto.hpp>
|
||||
#include <net.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <util/bencode.hpp>
|
||||
#include <util/bits.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <bencode.h>
|
||||
#include <exit_route.h>
|
||||
|
||||
#include <llarp/string.h>
|
||||
|
||||
bool
|
||||
llarp_xr_bencode(struct llarp_xr* xr, llarp_buffer_t* buff)
|
||||
{
|
||||
char addr_buff[128] = {0};
|
||||
const char* addr;
|
||||
|
||||
if(!bencode_start_dict(buff))
|
||||
return false;
|
||||
|
||||
/** gateway */
|
||||
addr = inet_ntop(AF_INET6, &xr->gateway, addr_buff, sizeof(addr_buff));
|
||||
if(!addr)
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, "a", 1))
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, addr, strnlen(addr, sizeof(addr_buff))))
|
||||
return false;
|
||||
|
||||
/** netmask */
|
||||
addr = inet_ntop(AF_INET6, &xr->netmask, addr_buff, sizeof(addr_buff));
|
||||
if(!addr)
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, "b", 1))
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, addr, strnlen(addr, sizeof(addr_buff))))
|
||||
return false;
|
||||
|
||||
/** source */
|
||||
addr = inet_ntop(AF_INET6, &xr->source, addr_buff, sizeof(addr_buff));
|
||||
if(!addr)
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, "c", 1))
|
||||
return false;
|
||||
if(!bencode_write_bytestring(buff, addr, strnlen(addr, sizeof(addr_buff))))
|
||||
return false;
|
||||
|
||||
/** lifetime */
|
||||
if(!bencode_write_bytestring(buff, "l", 1))
|
||||
return false;
|
||||
if(!bencode_write_uint64(buff, xr->lifetime))
|
||||
return false;
|
||||
|
||||
/** version */
|
||||
if(!bencode_write_version_entry(buff))
|
||||
return false;
|
||||
|
||||
/* end */
|
||||
return bencode_end(buff);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef LLARP_XR_H
|
||||
#define LLARP_XR_H
|
||||
|
||||
#include <buffer.h>
|
||||
#include <net.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct llarp_xr
|
||||
{
|
||||
struct in6_addr gateway;
|
||||
struct in6_addr netmask;
|
||||
struct in6_addr source;
|
||||
uint64_t lifetime;
|
||||
};
|
||||
|
||||
bool
|
||||
llarp_xr_bencode(struct llarp_xr* xr, llarp_buffer_t* buff);
|
||||
bool
|
||||
llarp_xr_bdecode(struct llarp_xr* xr, llarp_buffer_t* buff);
|
||||
|
||||
#endif
|
|
@ -1 +0,0 @@
|
|||
#include <fs.hpp>
|
|
@ -1,8 +1,10 @@
|
|||
#include <handlers/exit.hpp>
|
||||
#include <net.hpp>
|
||||
#include <router.hpp>
|
||||
#include <str.hpp>
|
||||
|
||||
#include <dns/dns.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <router.hpp>
|
||||
#include <util/str.hpp>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace llarp
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <ev.hpp>
|
||||
#include <router.hpp>
|
||||
#include <dns/dns.hpp>
|
||||
#include <ev/ev.hpp>
|
||||
#include <router.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <codel.hpp>
|
||||
#include <dns/server.hpp>
|
||||
#include <ev.h>
|
||||
#include <ev/ev.h>
|
||||
#include <ip.hpp>
|
||||
#include <net.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <service/endpoint.hpp>
|
||||
#include <threading.hpp>
|
||||
#include <util/threading.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <ini.hpp>
|
|
@ -1,7 +1,8 @@
|
|||
#include <buffer.hpp>
|
||||
#include <endian.hpp>
|
||||
#include <ip.hpp>
|
||||
#include <mem.hpp>
|
||||
|
||||
#include <util/buffer.hpp>
|
||||
#include <util/endian.hpp>
|
||||
#include <util/mem.hpp>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef LLARP_IP_HPP
|
||||
#define LLARP_IP_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
#include <ev.h>
|
||||
#include <net.hpp>
|
||||
#include <time.hpp>
|
||||
#include <ev/ev.h>
|
||||
#include <net/net.hpp>
|
||||
#include <util/buffer.h>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#ifndef _WIN32
|
||||
// unix, linux
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef LLARP_LINK_ENCODER_HPP
|
||||
#define LLARP_LINK_ENCODER_HPP
|
||||
|
||||
#include <bencode.h>
|
||||
#include <buffer.h>
|
||||
#include <router_contact.hpp>
|
||||
|
||||
#include <util/bencode.h>
|
||||
#include <util/buffer.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
/// encode Link Introduce Message onto a buffer
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue