mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
clang format
This commit is contained in:
parent
3183d5a19e
commit
88670928f0
@ -4,9 +4,8 @@
|
||||
|
||||
#include <llarp/handlers/tun.hpp>
|
||||
|
||||
|
||||
std::string const default_chars =
|
||||
"abcdefghijklmnaoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
"abcdefghijklmnaoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
|
||||
#include <random>
|
||||
|
||||
@ -31,7 +30,7 @@ struct check_query_simple_request
|
||||
};
|
||||
|
||||
std::map< std::string, struct dnsd_query_hook_response * >
|
||||
loki_tld_lookup_cache;
|
||||
loki_tld_lookup_cache;
|
||||
|
||||
void
|
||||
llarp_dotlokilookup_checkQuery(void *u, uint64_t orig, uint64_t left)
|
||||
@ -43,7 +42,7 @@ llarp_dotlokilookup_checkQuery(void *u, uint64_t orig, uint64_t left)
|
||||
struct check_query_simple_request *qr =
|
||||
static_cast< struct check_query_simple_request * >(u);
|
||||
dotLokiLookup *dll = (dotLokiLookup *)qr->request->context->user;
|
||||
if (!dll)
|
||||
if(!dll)
|
||||
{
|
||||
llarp::LogError("DNSd dotLokiLookup is not configured");
|
||||
return;
|
||||
@ -67,11 +66,13 @@ llarp_dotlokilookup_checkQuery(void *u, uint64_t orig, uint64_t left)
|
||||
}
|
||||
in_addr ip_address = ((sockaddr_in *)free_private->hostResult)->sin_addr;
|
||||
|
||||
llarp::handlers::TunEndpoint *tunEndpoint = (llarp::handlers::TunEndpoint *)dll->user;
|
||||
llarp::handlers::TunEndpoint *tunEndpoint =
|
||||
(llarp::handlers::TunEndpoint *)dll->user;
|
||||
bool mapResult = tunEndpoint->MapAddress(addr, ntohl(ip_address.s_addr));
|
||||
/*
|
||||
bool mapResult = main_router_mapAddress(
|
||||
ctx, addr, ntohl(ip_address.s_addr)); // maybe ntohl on the s_addr
|
||||
ctx, addr,
|
||||
ntohl(ip_address.s_addr)); // maybe ntohl on the s_addr
|
||||
*/
|
||||
if(!mapResult)
|
||||
{
|
||||
@ -105,7 +106,8 @@ llarp_dotlokilookup_handler(std::string name, const struct sockaddr *from,
|
||||
struct dnsd_question_request *request)
|
||||
{
|
||||
dnsd_query_hook_response *response = new dnsd_query_hook_response;
|
||||
//dotLokiLookup *dll = (dotLokiLookup *)request->context->user;
|
||||
// dotLokiLookup *dll = (dotLokiLookup
|
||||
// *)request->context->user;
|
||||
response->dontLookUp = false;
|
||||
response->dontSendResponse = false;
|
||||
response->returnThis = nullptr;
|
||||
@ -139,14 +141,15 @@ llarp_dotlokilookup_handler(std::string name, const struct sockaddr *from,
|
||||
|
||||
// start path build early (if you're looking it up, you're probably going to
|
||||
// use it)
|
||||
//main_router_prefetch(ctx, addr);
|
||||
// main_router_prefetch(ctx, addr);
|
||||
|
||||
// schedule future response
|
||||
check_query_simple_request *qr = new check_query_simple_request;
|
||||
qr->from = from;
|
||||
qr->request = request;
|
||||
// nslookup on osx is about 5 sec before a retry, 2s on linux
|
||||
llarp_logic_call_later(request->context->client.logic, {2000, qr, &llarp_dotlokilookup_checkQuery});
|
||||
llarp_logic_call_later(request->context->client.logic,
|
||||
{2000, qr, &llarp_dotlokilookup_checkQuery});
|
||||
|
||||
response->dontSendResponse = true;
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
|
||||
#include "dnsd.hpp"
|
||||
|
||||
typedef bool (*map_address_hook_func)(const llarp::service::Address &addr, uint32_t ip);
|
||||
typedef bool (*map_address_hook_func)(const llarp::service::Address &addr,
|
||||
uint32_t ip);
|
||||
|
||||
/// dotLokiLookup
|
||||
struct dotLokiLookup
|
||||
@ -20,14 +21,15 @@ struct dotLokiLookup
|
||||
/// which ip tracker to use
|
||||
struct dns_iptracker *ip_tracker;
|
||||
/// tunEndpoint
|
||||
//llarp::handlers::TunEndpoint *tunEndpoint; // is this even needed here?
|
||||
// llarp::handlers::TunEndpoint *tunEndpoint; // is this even needed here?
|
||||
void *user;
|
||||
// pointer to tunendpoint properties?
|
||||
|
||||
// need a way to reference
|
||||
// 1. mapaddress
|
||||
map_address_hook_func map_address_handler;
|
||||
//std::function< bool(const llarp::service::Address &addr, uint32_t ip), llarp::handlers::TunEndpoint * > callback;
|
||||
// std::function< bool(const llarp::service::Address &addr, uint32_t ip),
|
||||
// llarp::handlers::TunEndpoint * > callback;
|
||||
// 2. prefetch
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user