deploy: c0f5063e07e10c5e9d8987c000b9ae1c3a7d2929

This commit is contained in:
jm-clius 2022-07-21 11:23:59 +00:00
parent 14fc817ad9
commit 263c8d22a1
4 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "0.1.2"
version = "0.2.0"
author = "Huy Doan"
description = "Simple DNS Client & Library"
license = "MIT"

View File

@ -1,9 +1,11 @@
type TXTRecord* = ref object of ResourceRecord
length*: uint8
data*: string
strings*: seq[string]
method toString*(r: TXTRecord): string = r.data
method toString*(r: TXTRecord): string = r.strings.join()
method parse*(r: TXTRecord, data: StringStream) =
r.length = data.readUint8()
r.data = data.readStr(r.length.int)
var bytesLeft = r.rdlength.int
while bytesLeft > 0:
let length = data.readUint8()
r.strings.add(data.readStr(length.int))
bytesLeft -= length.int + 1

View File

@ -25,7 +25,7 @@ test "query TXT":
let resp = client.sendQuery("txt.example.huy.im", TXT)
assert resp.answers[0].kind == TXT
let rr = TXTRecord(resp.answers[0])
assert rr.data == "dnsclient.nim"
assert rr.strings == @["dnsclient.nim"]
test "query MX":
let resp = client.sendQuery("mx.example.huy.im", MX)

View File

@ -2,7 +2,7 @@
# libtool - Provide generalized library-building support services.
# Generated automatically by config.status (libbacktrace) version-unused
# Libtool was configured on host fv-az128-156:
# Libtool was configured on host fv-az208-167:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,