Skip to content

Commit

Permalink
moved code around
Browse files Browse the repository at this point in the history
  • Loading branch information
randomlogin committed Jan 23, 2024
1 parent 04a4aaf commit f0bacfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Package version (semver)
define(MAJOR, 2)
define(MINOR, 99)
define(PATCH, 1)
define(PATCH, 0)

# Shared library version
# see: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
Expand Down
24 changes: 5 additions & 19 deletions src/hesiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "pool.h"
#include "req.h"



static bool
hsk_hesiod_txt_push(char *name, char *text, hsk_dns_rrs_t *an) {
hsk_dns_rr_t *rr = hsk_dns_rr_create(HSK_DNS_TXT);
Expand Down Expand Up @@ -121,23 +119,6 @@ hsk_hesiod_resolve(hsk_dns_req_t *req, hsk_ns_t *ns) {
msg->flags |= HSK_DNS_AA;
hsk_dns_rrs_t *an = &msg->an;


// POOL
// SIZE
if (hsk_dns_is_subdomain(req->name, "size.pool.hnsd.")) {
char size[65];
sprintf(size, "%d", ns->pool->size);
if (!hsk_hesiod_txt_push("size.pool.hnsd.", size, an))
goto fail;
}

// PEERS
if (hsk_dns_is_subdomain(req->name, "name_root.tip.chain.hnsd.")) {
if (!hsk_hesiod_txt_push_hash("name_root.tip.chain.hnsd.", ns->pool->chain.tip->name_root, an))
goto fail;
}


// CHAIN
// TIP
if (hsk_dns_is_subdomain(req->name, "hash.tip.chain.hnsd.")) {
Expand All @@ -154,6 +135,11 @@ hsk_hesiod_resolve(hsk_dns_req_t *req, hsk_ns_t *ns) {
goto fail;
}

if (hsk_dns_is_subdomain(req->name, "name_root.tip.chain.hnsd.")) {
if (!hsk_hesiod_txt_push_hash("name_root.tip.chain.hnsd.", ns->pool->chain.tip->name_root, an))
goto fail;
}

if (hsk_dns_is_subdomain(req->name, "time.tip.chain.hnsd.")) {
if (!hsk_hesiod_txt_push_u64("time.tip.chain.hnsd.",
ns->pool->chain.tip->time,
Expand Down

0 comments on commit f0bacfe

Please sign in to comment.