mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
move logic into client
This commit is contained in:
parent
e53e093e17
commit
31595d209d
@ -384,8 +384,8 @@ raw_handle_recvfrom(int *sockfd, const struct sockaddr *saddr, const void *buf,
|
||||
}
|
||||
|
||||
bool
|
||||
llarp_dnsd_init(struct dnsd_context *dnsd, struct llarp_ev_loop *netloop,
|
||||
struct llarp_logic *logic, const char *dnsd_ifname,
|
||||
llarp_dnsd_init(struct dnsd_context *dnsd, struct llarp_logic *logic,
|
||||
struct llarp_ev_loop *netloop, const char *dnsd_ifname,
|
||||
uint16_t dnsd_port, const char *dnsc_hostname,
|
||||
uint16_t dnsc_port)
|
||||
{
|
||||
@ -400,12 +400,13 @@ llarp_dnsd_init(struct dnsd_context *dnsd, struct llarp_ev_loop *netloop,
|
||||
|
||||
dns_udp_tracker.dnsd = dnsd;
|
||||
|
||||
dnsd->tracker = &dns_udp_tracker; // register global tracker with context
|
||||
dnsd->logic = logic; // set logic worker for timers
|
||||
dnsd->intercept = nullptr; // set default intercepter
|
||||
dnsd->tracker = &dns_udp_tracker; // register global tracker with context
|
||||
// dnsd->logic = logic; // set logic worker for timers
|
||||
dnsd->intercept = nullptr; // set default intercepter
|
||||
|
||||
// configure dns client
|
||||
if(!llarp_dnsc_init(&dnsd->client, &dnsd->udp, dnsc_hostname, dnsc_port))
|
||||
if(!llarp_dnsc_init(&dnsd->client, logic, &dnsd->udp, dnsc_hostname,
|
||||
dnsc_port))
|
||||
{
|
||||
llarp::LogError("Couldnt init dns client");
|
||||
return false;
|
||||
|
@ -53,13 +53,11 @@ struct dnsd_context
|
||||
{
|
||||
/// DNS daemon socket to listen on
|
||||
struct llarp_udp_io udp;
|
||||
/// for timers (MAYBEFIXME? maybe we decouple this, yes pls have a generic passed in)
|
||||
struct llarp_logic *logic;
|
||||
/// tracker
|
||||
/// udp tracker
|
||||
struct dns_tracker *tracker;
|
||||
/// upstream DNS client context to use
|
||||
dnsc_context client;
|
||||
/// custom data for intercept query hook
|
||||
/// custom data for intercept query hook (used for configuration of hook)
|
||||
void *user;
|
||||
/// hook function for intercepting dns requests
|
||||
intercept_query_hook intercept;
|
||||
@ -83,8 +81,8 @@ writesend_dnss_response(struct sockaddr *hostRes, const struct sockaddr *from,
|
||||
/// initialize dns subsystem and bind socket
|
||||
/// returns true on bind success otherwise returns false
|
||||
bool
|
||||
llarp_dnsd_init(struct dnsd_context *dnsd, struct llarp_ev_loop *netloop,
|
||||
struct llarp_logic *logic, const char *dnsd_ifname,
|
||||
llarp_dnsd_init(struct dnsd_context *dnsd, struct llarp_logic *logic,
|
||||
struct llarp_ev_loop *netloop, const char *dnsd_ifname,
|
||||
uint16_t dnsd_port, const char *dnsc_hostname,
|
||||
uint16_t dnsc_port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user