mirror of
https://github.com/EmilHernvall/dnsguide.git
synced 2024-12-22 20:44:17 +07:00
rustfmt examples/*.rs
This commit is contained in:
parent
abd3bb9525
commit
24a949c4d4
@ -300,10 +300,7 @@ pub struct DnsQuestion {
|
||||
|
||||
impl DnsQuestion {
|
||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||
DnsQuestion {
|
||||
name,
|
||||
qtype,
|
||||
}
|
||||
DnsQuestion { name, qtype }
|
||||
}
|
||||
|
||||
pub fn read(&mut self, buffer: &mut BytePacketBuffer) -> Result<()> {
|
||||
@ -352,11 +349,7 @@ impl DnsRecord {
|
||||
((raw_addr >> 0) & 0xFF) as u8,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::A {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::A { domain, addr, ttl })
|
||||
}
|
||||
QueryType::UNKNOWN(_) => {
|
||||
buffer.step(data_len as usize)?;
|
||||
|
@ -336,10 +336,7 @@ pub struct DnsQuestion {
|
||||
|
||||
impl DnsQuestion {
|
||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||
DnsQuestion {
|
||||
name,
|
||||
qtype,
|
||||
}
|
||||
DnsQuestion { name, qtype }
|
||||
}
|
||||
|
||||
pub fn read(&mut self, buffer: &mut BytePacketBuffer) -> Result<()> {
|
||||
@ -398,11 +395,7 @@ impl DnsRecord {
|
||||
((raw_addr >> 0) & 0xFF) as u8,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::A {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::A { domain, addr, ttl })
|
||||
}
|
||||
QueryType::UNKNOWN(_) => {
|
||||
buffer.step(data_len as usize)?;
|
||||
|
@ -361,10 +361,7 @@ pub struct DnsQuestion {
|
||||
|
||||
impl DnsQuestion {
|
||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||
DnsQuestion {
|
||||
name,
|
||||
qtype,
|
||||
}
|
||||
DnsQuestion { name, qtype }
|
||||
}
|
||||
|
||||
pub fn read(&mut self, buffer: &mut BytePacketBuffer) -> Result<()> {
|
||||
@ -444,11 +441,7 @@ impl DnsRecord {
|
||||
((raw_addr >> 0) & 0xFF) as u8,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::A {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::A { domain, addr, ttl })
|
||||
}
|
||||
QueryType::AAAA => {
|
||||
let raw_addr1 = buffer.read_u32()?;
|
||||
@ -466,11 +459,7 @@ impl DnsRecord {
|
||||
((raw_addr4 >> 0) & 0xFFFF) as u16,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::AAAA {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::AAAA { domain, addr, ttl })
|
||||
}
|
||||
QueryType::NS => {
|
||||
let mut ns = String::new();
|
||||
|
@ -361,10 +361,7 @@ pub struct DnsQuestion {
|
||||
|
||||
impl DnsQuestion {
|
||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||
DnsQuestion {
|
||||
name,
|
||||
qtype,
|
||||
}
|
||||
DnsQuestion { name, qtype }
|
||||
}
|
||||
|
||||
pub fn read(&mut self, buffer: &mut BytePacketBuffer) -> Result<()> {
|
||||
@ -444,11 +441,7 @@ impl DnsRecord {
|
||||
((raw_addr >> 0) & 0xFF) as u8,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::A {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::A { domain, addr, ttl })
|
||||
}
|
||||
QueryType::AAAA => {
|
||||
let raw_addr1 = buffer.read_u32()?;
|
||||
@ -466,11 +459,7 @@ impl DnsRecord {
|
||||
((raw_addr4 >> 0) & 0xFFFF) as u16,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::AAAA {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::AAAA { domain, addr, ttl })
|
||||
}
|
||||
QueryType::NS => {
|
||||
let mut ns = String::new();
|
||||
@ -793,7 +782,7 @@ fn main() -> Result<()> {
|
||||
// requests is initiated.
|
||||
loop {
|
||||
match handle_query(&socket) {
|
||||
Ok(_) => {},
|
||||
Ok(_) => {}
|
||||
Err(e) => eprintln!("An error occurred: {}", e),
|
||||
}
|
||||
}
|
||||
|
@ -361,10 +361,7 @@ pub struct DnsQuestion {
|
||||
|
||||
impl DnsQuestion {
|
||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||
DnsQuestion {
|
||||
name,
|
||||
qtype,
|
||||
}
|
||||
DnsQuestion { name, qtype }
|
||||
}
|
||||
|
||||
pub fn read(&mut self, buffer: &mut BytePacketBuffer) -> Result<()> {
|
||||
@ -444,11 +441,7 @@ impl DnsRecord {
|
||||
((raw_addr >> 0) & 0xFF) as u8,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::A {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::A { domain, addr, ttl })
|
||||
}
|
||||
QueryType::AAAA => {
|
||||
let raw_addr1 = buffer.read_u32()?;
|
||||
@ -466,11 +459,7 @@ impl DnsRecord {
|
||||
((raw_addr4 >> 0) & 0xFFFF) as u16,
|
||||
);
|
||||
|
||||
Ok(DnsRecord::AAAA {
|
||||
domain,
|
||||
addr,
|
||||
ttl,
|
||||
})
|
||||
Ok(DnsRecord::AAAA { domain, addr, ttl })
|
||||
}
|
||||
QueryType::NS => {
|
||||
let mut ns = String::new();
|
||||
@ -886,7 +875,7 @@ fn main() -> Result<()> {
|
||||
|
||||
loop {
|
||||
match handle_query(&socket) {
|
||||
Ok(_) => {},
|
||||
Ok(_) => {}
|
||||
Err(e) => eprintln!("An error occurred: {}", e),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user