Module dns

Source
Expand description

Houses the DNS-specifc 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