1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Move net components into a distinct folder

This commit is contained in:
Michael 2019-01-11 01:42:02 +00:00
parent 317e29b777
commit a3463120cc
No known key found for this signature in database
GPG key ID: 2D51757B47E2434C
46 changed files with 62 additions and 142 deletions

View file

@ -311,9 +311,9 @@ set(LIB_UTIL_SRC
set(LIB_PLATFORM_SRC
# for networking
llarp/ev/ev.cpp
llarp/net.cpp
llarp/net_addr.cpp
llarp/net_inaddr.cpp
llarp/net/net.cpp
llarp/net/net_addr.cpp
llarp/net/net_inaddr.cpp
# for android shim
${ANDROID_PLATFORM_SRC}
# process isolation implementation
@ -522,7 +522,6 @@ set(LIB_SRC
llarp/exit/transfer_traffic.cpp
llarp/exit/update_exit.cpp
llarp/exit_info.cpp
llarp/exit_route.cpp
llarp/handlers/exit.cpp
llarp/handlers/null.cpp
llarp/handlers/tun.cpp
@ -547,7 +546,7 @@ 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/path.cpp
llarp/path/path_types.cpp
@ -599,27 +598,27 @@ 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/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/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_dht_key.cpp
test/test_llarp_dns.cpp
test/test_llarp_dnsd.cpp
test/test_llarp_encrypted_frame.cpp
test/test_llarp_net_inaddr.cpp
test/test_llarp_net.cpp
test/test_llarp_router_contact.cpp
test/util/test_llarp_util_aligned.cpp
test/util/test_llarp_util_bencode.cpp

View file

@ -2,11 +2,11 @@
#ifndef _WIN32
#include <arpa/inet.h>
#endif
#include <net/net.hpp>
#include <util/bencode.h>
#include <util/mem.h>
#include <string.h>
#include <net.hpp>
namespace llarp
{

View file

@ -2,7 +2,7 @@
#define LLARP_AI_HPP
#include <crypto.hpp>
#include <net.h>
#include <net/net.h>
#include <util/bencode.hpp>
#include <util/mem.h>

View file

@ -2,7 +2,7 @@
#include <config.hpp>
#include <constants/defaults.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <util/fs.hpp>
#include <util/ini.hpp>
#include <util/logger.hpp>
@ -141,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 << "# ";

View file

@ -9,7 +9,7 @@
#endif
#include <dns/rectypes.hpp>
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
#include <net/net.hpp> // for llarp::Addr , llarp::huint32_t
#include <map>
#include <string>

View file

@ -2,7 +2,7 @@
#define LLARP_DNSIPTRACKER_HPP
#include <dns/dotlokilookup.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <service/address.hpp>
#include <map>

View file

@ -1,5 +1,5 @@
#include <dns/name.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <algorithm>
#include <sstream>

View file

@ -1,7 +1,7 @@
#ifndef LLARP_DNS_NAME_HPP
#define LLARP_DNS_NAME_HPP
#include <net_int.hpp>
#include <net/net_int.hpp>
#include <util/buffer.h>
#include <string>

View file

@ -3,7 +3,7 @@
#include <dns/serialize.hpp>
#include <dns/name.hpp>
#include <net_int.hpp>
#include <net/net_int.hpp>
namespace llarp
{

View file

@ -1,7 +1,7 @@
#ifndef LLARP_DNS_REC_TYPES_HPP
#define LLARP_DNS_REC_TYPES_HPP
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
#include <net/net.hpp> // for llarp::Addr , llarp::huint32_t
#include <util/buffer.h> // for byte_t
#include <vector>

View file

@ -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>

View file

@ -1,5 +1,5 @@
#include <dns/serialize.hpp>
#include <net_int.hpp>
#include <net/net_int.hpp>
namespace llarp
{

View file

@ -3,7 +3,7 @@
#include <dns/message.hpp>
#include <ev/ev.h>
#include <net.hpp>
#include <net/net.hpp>
#include <util/string_view.hpp>
#include <unordered_map>

View file

@ -1,5 +1,5 @@
#include <dnsc.hpp>
#include <net.hpp> // for llarp::Addr
#include <net/net.hpp> // for llarp::Addr
#include <util/logger.hpp>
#ifndef _WIN32

View file

@ -1,5 +1,5 @@
#include <dnsd.hpp>
#include <net.hpp>
#include <net/net.hpp>
extern dns_tracker dns_udp_tracker;

View file

@ -2,8 +2,8 @@
#define EV_EPOLL_HPP
#include <ev/ev.hpp>
#include <net.h>
#include <net.hpp>
#include <net/net.h>
#include <net/net.hpp>
#include <util/buffer.h>
#include <util/buffer.hpp>
#include <util/logger.hpp>

View file

@ -2,8 +2,8 @@
#define EV_KQUEUE_HPP
#include <ev/ev.hpp>
#include <net.h>
#include <net.hpp>
#include <net/net.h>
#include <net/net.hpp>
#include <util/buffer.h>
#include <util/logger.hpp>

View file

@ -4,8 +4,8 @@
#include <buffer.h>
#include <ev/ev.hpp>
#include <util/logger.hpp>
#include <net.h>
#include <net.hpp>
#include <net/net.h>
#include <net/net.hpp>
#include <windows.h>
#include <process.h>

View file

@ -2,7 +2,7 @@
#define LLARP_XI_HPP
#include <crypto.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <util/bencode.hpp>
#include <util/bits.hpp>

View file

@ -1,58 +0,0 @@
#ifndef _WIN32
#include <arpa/inet.h>
#endif
#include <exit_route.h>
#include <util/bencode.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);
}

View file

@ -1,22 +0,0 @@
#ifndef LLARP_XR_H
#define LLARP_XR_H
#include <net.h>
#include <util/buffer.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

View file

@ -1,7 +1,7 @@
#include <handlers/exit.hpp>
#include <dns/dns.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <router.hpp>
#include <util/str.hpp>

View file

@ -5,7 +5,7 @@
#include <dns/server.hpp>
#include <ev/ev.h>
#include <ip.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <service/endpoint.hpp>
#include <util/threading.hpp>

View file

@ -2,7 +2,7 @@
#define LLARP_IP_HPP
#include <ev/ev.h>
#include <net.hpp>
#include <net/net.hpp>
#include <util/buffer.h>
#include <util/time.hpp>

View file

@ -4,7 +4,7 @@
#include <crypto.hpp>
#include <ev/ev.h>
#include <link/session.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <router_contact.hpp>
#include <util/logic.hpp>
#include <util/threading.hpp>

View file

@ -2,7 +2,7 @@
#define LLARP_LINK_SESSION_HPP
#include <crypto.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <router_contact.hpp>
#include <util/types.hpp>

View file

@ -1,4 +1,4 @@
#include <net.hpp>
#include <net/net.hpp>
#ifdef ANDROID
#include "android/ifaddrs.h"
#endif
@ -9,7 +9,7 @@
#endif
#include <net/if.h>
#endif
#include <net_addr.hpp>
#include <net/net_addr.hpp>
#include <util/logger.hpp>
#include <util/str.hpp>

View file

@ -2,8 +2,8 @@
#define LLARP_NET_HPP
#include <address_info.hpp>
#include <net_int.hpp>
#include <net.h>
#include <net/net_int.hpp>
#include <net/net.h>
#include <util/logger.hpp>
#include <util/mem.hpp>
#include <util/string_view.hpp>
@ -147,7 +147,7 @@ namespace llarp
} // namespace llarp
#include <net_addr.hpp>
#include <net_inaddr.hpp>
#include <net/net_addr.hpp>
#include <net/net_inaddr.hpp>
#endif

View file

@ -1,5 +1,5 @@
#include <net.hpp>
#include <net_addr.hpp>
#include <net/net.hpp>
#include <net/net_addr.hpp>
#include <util/string_view.hpp>
// for addrinfo

View file

@ -2,8 +2,8 @@
#define LLARP_NET_ADDR_HPP
#include <address_info.hpp>
#include <net.h>
#include <net.hpp>
#include <net/net.h>
#include <net/net.hpp>
#include <util/string_view.hpp>
#include <string>

View file

@ -1,4 +1,4 @@
#include <net_inaddr.hpp>
#include <net/net_inaddr.hpp>
std::ostream&
operator<<(std::ostream& out, const llarp::inAddr& a)

View file

@ -1,7 +1,7 @@
#ifndef LLARP_NET_INADDR_HPP
#define LLARP_NET_INADDR_HPP
#include <net.hpp>
#include <net/net.hpp>
namespace llarp
{

1
llarp/net/net_int.cpp Normal file
View file

@ -0,0 +1 @@
#include <net/net_int.hpp>

View file

@ -12,7 +12,7 @@
#define inet_aton(x, y) inet_pton(AF_INET, x, y)
#endif
#include <net.h>
#include <net/net.h>
#include <stdlib.h> // for itoa
#include <iostream>

View file

@ -1 +0,0 @@
#include <net_int.hpp>

View file

@ -7,7 +7,7 @@
#include <link/iwp.hpp>
#include <link/server.hpp>
#include <link/utp.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <rpc.hpp>
#include <util/buffer.hpp>
#include <util/encode.hpp>
@ -127,7 +127,7 @@ llarp_findOrCreateEncryption(llarp::Crypto *crypto, const fs::path &path,
llarp::SecretKey &encryption)
{
std::string fpath = path.string();
llarp::LogDebug("find or create ",fpath);
llarp::LogDebug("find or create ", fpath);
std::error_code ec;
if(!fs::exists(path, ec))
{
@ -1041,7 +1041,7 @@ namespace llarp
{
if(!link->Start(logic))
{
llarp::LogWarn("outbound link '", link->Name(),"' failed to start");
llarp::LogWarn("outbound link '", link->Name(), "' failed to start");
return false;
}
}

View file

@ -2,7 +2,7 @@
#include <constants/version.hpp>
#include <crypto.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <util/bencode.hpp>
#include <util/buffer.hpp>
#include <util/logger.hpp>

View file

@ -2,7 +2,7 @@
#define LLARP_SERVICE_CONTEXT_HPP
#include <handlers/tun.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <service/config.hpp>
#include <service/endpoint.hpp>

View file

@ -4,7 +4,7 @@
#include <codel.hpp>
#include <ev/ev.h>
#include <exit/session.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <path/path.hpp>
#include <path/pathbuilder.hpp>
#include <service/address.hpp>

View file

@ -4,7 +4,8 @@
#include <dns/message.hpp>
#include <dns/name.hpp>
#include <dns/rr.hpp>
#include <net.hpp>
#include <net/net.hpp>
#include <util/buffer.hpp>
#include <algorithm>

View file

@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include <net.hpp>
#include <net_inaddr.hpp>
#include <net/net.hpp>
#include <net/net_inaddr.hpp>
struct TestNet : public ::testing::Test
{

View file

@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include <net_inaddr.hpp>
#include <net/net_inaddr.hpp>
struct TestNetInAddr : public ::testing::Test
{

View file

@ -3,7 +3,7 @@
#include <dns.hpp>
#include <dnsc.hpp>
#include <llarp.h> // for llarp_main_init
#include <net.hpp> // for llarp::Addr
#include <net/net.hpp> // for llarp::Addr
#include <util/logic.hpp> // for threadpool/llarp::Logic
struct DNSTest : public ::testing::Test

View file

@ -3,7 +3,7 @@
#include <dnsd.hpp>
#include <llarp.h> // for llarp_main_init
#include <net.hpp> // for llarp::Addr
#include <net/net.hpp> // for llarp::Addr
#include <util/logic.hpp> // for threadpool/llarp::Logic
unsigned int g_length = 0;