diff --git a/src/apiserver.nim b/src/apiserver.nim index c6eb6e1..730609d 100644 --- a/src/apiserver.nim +++ b/src/apiserver.nim @@ -42,6 +42,8 @@ proc present(req: Request, auth: Auth, base: string): Future[void] {.async.} = let record = to(parseJson(req.body), NewRecordReq) let name = trimName(record.fqdn) & "." & auth.name & "." & base + echo &"Adding TXT record for {name} with value {record.value}" + addRecord( records, (name: name, dtype: DnsType.TXT), @@ -54,6 +56,8 @@ proc cleanup(req: Request, auth: Auth, base: string): Future[void] {.async.} = let record = to(parseJson(req.body), NewRecordReq) let name = trimName(record.fqdn) & "." & auth.name & "." & base + echo &"Deleting TXT record for {name} with value {record.value}" + delRecord( records, (name: name, dtype: DnsType.TXT), diff --git a/src/dnsserver.nim b/src/dnsserver.nim index 5d59043..cc9a284 100644 --- a/src/dnsserver.nim +++ b/src/dnsserver.nim @@ -5,6 +5,8 @@ import ../lib/dns, state proc handleDnsRequest(records: RecordsTable, data: string): Option[string] = let msg = parseMessage(data) + echo msg + if len(msg.questions) == 0: return @@ -15,6 +17,8 @@ proc handleDnsRequest(records: RecordsTable, data: string): Option[string] = records.getOrDefault((name: question.qname, dtype: question.qtype), @[]) ) + echo response + return some(packMessage(response)) proc serveDns*(config: AppConfig) {.async.} =