Log queries
This commit is contained in:
parent
23474bc89a
commit
389f05f316
|
@ -42,6 +42,8 @@ proc present(req: Request, auth: Auth, base: string): Future[void] {.async.} =
|
||||||
let record = to(parseJson(req.body), NewRecordReq)
|
let record = to(parseJson(req.body), NewRecordReq)
|
||||||
let name = trimName(record.fqdn) & "." & auth.name & "." & base
|
let name = trimName(record.fqdn) & "." & auth.name & "." & base
|
||||||
|
|
||||||
|
echo &"Adding TXT record for {name} with value {record.value}"
|
||||||
|
|
||||||
addRecord(
|
addRecord(
|
||||||
records,
|
records,
|
||||||
(name: name, dtype: DnsType.TXT),
|
(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 record = to(parseJson(req.body), NewRecordReq)
|
||||||
let name = trimName(record.fqdn) & "." & auth.name & "." & base
|
let name = trimName(record.fqdn) & "." & auth.name & "." & base
|
||||||
|
|
||||||
|
echo &"Deleting TXT record for {name} with value {record.value}"
|
||||||
|
|
||||||
delRecord(
|
delRecord(
|
||||||
records,
|
records,
|
||||||
(name: name, dtype: DnsType.TXT),
|
(name: name, dtype: DnsType.TXT),
|
||||||
|
|
|
@ -5,6 +5,8 @@ import ../lib/dns, state
|
||||||
proc handleDnsRequest(records: RecordsTable, data: string): Option[string] =
|
proc handleDnsRequest(records: RecordsTable, data: string): Option[string] =
|
||||||
let msg = parseMessage(data)
|
let msg = parseMessage(data)
|
||||||
|
|
||||||
|
echo msg
|
||||||
|
|
||||||
if len(msg.questions) == 0:
|
if len(msg.questions) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ proc handleDnsRequest(records: RecordsTable, data: string): Option[string] =
|
||||||
records.getOrDefault((name: question.qname, dtype: question.qtype), @[])
|
records.getOrDefault((name: question.qname, dtype: question.qtype), @[])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
echo response
|
||||||
|
|
||||||
return some(packMessage(response))
|
return some(packMessage(response))
|
||||||
|
|
||||||
proc serveDns*(config: AppConfig) {.async.} =
|
proc serveDns*(config: AppConfig) {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue