Skip to content

lateio/dnslib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dnslib

Build Status

dnslib will be a standards compliant, reliable and extensible library for working with Domain Name System (DNS) data. At the time of writing, however, it lacks the testing to verify it as any of the aforementioned.

dnslib can be included in an application when it is necessary to work with DNS master files or DNS wire format. A variety of functionality for working with DNS messages and assorted data types is included.

The reader should note that dnslib does not implement any of the networking functionality of DNS. While it will get an application up to the binary representation of a DNS message, dnslib will not send that binary anywhere.

Documentation for dnslib can be found in the doc/ directory.

Quick start

% Request
Question = dnslib:question("arv.io", a, in),
Request0 = dnsmsg:new(#{}, Question),
{ok, ReqBinLen, ReqBin} = dnswire:to_binary(Request0),
ReqBinLen = byte_size(ReqBin),
{ok, Request0, <<>>} = dnswire:from_binary(ReqBin),

% Response
Answer = dnslib:resource("arv.io IN 60 A 127.0.0.1"),
Request1 = dnsmsg:add_response_answer(Request0, Answer),
Response = dnsmsg:response(Request1),
{ok, ResBinLen, ResIolist} = dnswire:to_iolist(Response),
ResBin = iolist_to_binary(ResIolist),
ResBinLen = byte_size(ResBin),
{ok, Response, <<"Trailing">>} = dnswire:from_binary(<<ResBin/binary, "Trailing">>),

% Make sense of the response
{ok, [{Question, ok, [Answer]}]} = dnsmsg:interpret_response(Response),

% Keep the answer safe...
ok = dnsfile:write_resources("/BleepBloop/treasures", [Answer]),

% ...But but take a good look at it every now and then
{ok, [Answer]} = dnsfile:consult("/BleepBloop/treasures").

Compliance

dnslib claims to be compliant with the following specifications:

Roadmap

For version 0.0.3

  • Split QTYPE resource behavior from dnsrr module
  • Better eunit coverage
  • Common test suites to verify implemented standards documents
  • New opcodes/return codes/functionality as required by Kurremkarmerruk
  • PropEr (?)
  • Progress towards DNSSEC (?)

About

Library for working with DNS data in Erlang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages