Crate dominion

Source
Expand description

§Dominion

A crate to implement DNS Servers and clients.

§Server

use dominion::{Server, ServerService, DnsPacket};
use std::net::SocketAddr;

struct Echo;

impl ServerService for Echo {
    fn run<'a>(&self, _client: SocketAddr, question: &'a DnsPacket<'a>) -> Option<DnsPacket<'a>> { Some(question.clone()) }
}

Server::default()
        .bind("127.0.0.1:5353".parse().unwrap())
        .unwrap()
        .serve(Echo);

§Client

Modules§

body
The body of the DNS packet (Questions and Resource Records)
header
The header of the DNS packet
name
Domain name structure and funtions

Structs§

DnsHeader
A DNS header.
DnsPacket
Represents a complete DNS packet.
Flags
DNS Flags
Name
A domain name represented as an inverted list of labels.
Question
A query for a ResourceRecord of the specified QType and Class.
RecordPreamble
The ResourceRecord preamble. Common data to all resource record types.
ResourceRecord
A description of a resource that can be used as an answer to a question or to provide additional information in the authority or additional fields of a DNS packet.
Server
A DNS server

Enums§

AuthenticData
DNSSEC flag to indicate if the data has been cryptographically authenticated
AuthoritativeAnswer
Flag to indicate if the answer is authoritative
CheckingDisabled
DNSSEC flag to indicate if the client has enabled checking of the data.
Class
An enumeration of the different available DNS Classes.
NameError
An error was encountered when trying to work with a domain name
OpCode
Standard query (0), Inverse query (1), Server status query (2), Notify (4), Update (5), DSO (6)
ParseError
An error was encountered when trying to parse a byte buffer into a DNS packet
QType
The type of Question.
QueryResponse
Query (0) or Response (1) packet.
RecordData
The ResourceRecord data associated with the corresponding Name.
RecursionAvailable
Flag to indicate if recursion is available by the server.
RecursionDesired
Flag to indicate if recursion is desired by the client.
ResponseCode
Response code
TrunCation
Flag to indicate if the packet has been truncated.
Type
The type of ResourceRecord.
Zero
Reserved, should be 0.

Traits§

ServerService
A DNS service, it recieves a DnsPacket as a question and it has to return anotherone as a response.