Settings
Help

Module dns

Module dns 

Source
Expand description

Houses the DNS-specific code, including the structs that we pack the bytes into and suitable traits and implementations to convert to and from bytes and structs

Β§Disclaimer

This is a very barebones DNS client implementation. It hard-codes a lot of values and is intended only for demonstration purposes on how even custom protocols over TCP can be tunnelled through Tor. It is not meant for any real production usage.

StructsΒ§

DomainError
Error we return if a bad domain name is passed
FromBytesError πŸ”’
Generic error we return if we fail to parse bytes into the struct
Header πŸ”’
DNS Header to be used by both Query and Response
Query
The actual query we will send to a DNS server
ResourceRecord πŸ”’
A struct which represents one RR
Response
Stores the response in easy to interpret manner

ConstantsΒ§

DNS_SERVER
Hardcoded DNS server, stored as (&str, u16) detailing host and port
QCLASS πŸ”’
Default value for QCLASS field
QTYPE πŸ”’
Default value for QTYPE field

TraitsΒ§

AsBytes
Used to convert struct to raw bytes to be sent over the network
FromBytes
Used to convert raw bytes representation into a Rust struct
Len πŸ”’
Report length of the struct as in byte stream

FunctionsΒ§

build_query
Craft the actual query for a particular domain and returns a Query object