No description
Find a file
2021-07-01 19:00:28 +02:00
src Fix import and README 2021-07-01 19:00:28 +02:00
tests First version of resolv.nim 2021-07-01 18:20:16 +02:00
COPYING First version of resolv.nim 2021-07-01 18:20:16 +02:00
README.md Fix import and README 2021-07-01 19:00:28 +02:00
resolv.nimble First version of resolv.nim 2021-07-01 18:20:16 +02:00

resolv.nim

Nim bindings for the glibc resolution library -lresolv. it allows to resolve DNS queries using the system resolver. You don't have to use well-known DNS resolvers hardcoded or parse configuration files yourself.

Warning: this library is probably not thread safe due to the fact that the glibc library itself is not thread safe. Use it only in your main thread.

Example

import resolv

let rmsg = query("gmail.com", QType.MX)
if rmsg.header.flags.rcode == RCode.NoError:
  for ans in rmsg.answers:
    if ans.type != Type.MX: continue
    echo RDataMX(ans.rdata).preference
    echo RDataMX(ans.rdata).exchange