mirror of
https://github.com/EmilHernvall/dnsguide.git
synced 2025-07-30 06:38:16 +07:00
Clean up error handling in chapter 4 and 5
This commit is contained in:
@ -222,7 +222,7 @@ impl DnsPacket {
|
||||
/// However, not all name servers are as that nice. In certain cases there won't
|
||||
/// be any A records in the additional section, and we'll have to perform *another*
|
||||
/// lookup in the midst of our first. For this, we introduce a method for
|
||||
returning the hostname of an appropriate name server.
|
||||
/// returning the hostname of an appropriate name server.
|
||||
pub fn get_unresolved_ns(&self, qname: &str) -> Option<String> {
|
||||
// Get an iterator over the nameservers in the authorities section
|
||||
self.get_ns(qname)
|
||||
@ -299,11 +299,11 @@ fn recursive_lookup(qname: &str, qtype: QueryType) -> Result<DnsPacket> {
|
||||
|
||||
### Trying out recursive lookup
|
||||
|
||||
The only thing remaining is to change our main function to use
|
||||
The only thing remaining is to change our `handle_query` function to use
|
||||
`recursive_lookup`:
|
||||
|
||||
```rust
|
||||
fn main() -> Result<()> {
|
||||
fn handle_query(socket: &UdpSocket) -> Result<()> {
|
||||
|
||||
- snip -
|
||||
|
||||
|
Reference in New Issue
Block a user