This is a DNS client library written in V.
Supported query types:
- A
- AAAA
- AXFR
- CAA
- CNAME
- DNSKEY
- PTR
- MX
- NS
- SOA
- TLSA
- TXT
- URI
You can install this package either from [VPM] or from GitHub:
v install fleximus.vdns
v install --git https://github.com/fleximus/vdns
To use vdns
in order to run queries, you need to specify the resolver's IP address, here in our example we make use of Cloudflare's public 1.1.1.1 resolver.
import fleximus.vdns
fn main() {
resolver := '1.1.1.1:53'
result := vdns.query(vdns.Query{
domain: 'gmail.com'
@type: .mx
resolver: resolver
}) or { panic('Failed query') }
for answer in result.answers {
println("${answer.name} ${answer.class} ${answer.ttl} ${answer.@type} ${answer.record}")
}
}
This library is under development: Do NOT use in production!
MIT