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§
- Domain
Error - Error we return if a bad domain name is passed
- From
Bytes 🔒Error - 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
- Resource
Record 🔒 - 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
- From
Bytes - 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