mirror of
https://github.com/EmilHernvall/dnsguide.git
synced 2025-07-04 23:38:32 +07:00
simplify expressions
This commit is contained in:
@ -301,8 +301,8 @@ pub struct DnsQuestion {
|
|||||||
impl DnsQuestion {
|
impl DnsQuestion {
|
||||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||||
DnsQuestion {
|
DnsQuestion {
|
||||||
name: name,
|
name,
|
||||||
qtype: qtype,
|
qtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,19 +353,19 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::A {
|
Ok(DnsRecord::A {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::UNKNOWN(_) => {
|
QueryType::UNKNOWN(_) => {
|
||||||
buffer.step(data_len as usize)?;
|
buffer.step(data_len as usize)?;
|
||||||
|
|
||||||
Ok(DnsRecord::UNKNOWN {
|
Ok(DnsRecord::UNKNOWN {
|
||||||
domain: domain,
|
domain,
|
||||||
qtype: qtype_num,
|
qtype: qtype_num,
|
||||||
data_len: data_len,
|
data_len,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,8 +337,8 @@ pub struct DnsQuestion {
|
|||||||
impl DnsQuestion {
|
impl DnsQuestion {
|
||||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||||
DnsQuestion {
|
DnsQuestion {
|
||||||
name: name,
|
name,
|
||||||
qtype: qtype,
|
qtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,19 +399,19 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::A {
|
Ok(DnsRecord::A {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::UNKNOWN(_) => {
|
QueryType::UNKNOWN(_) => {
|
||||||
buffer.step(data_len as usize)?;
|
buffer.step(data_len as usize)?;
|
||||||
|
|
||||||
Ok(DnsRecord::UNKNOWN {
|
Ok(DnsRecord::UNKNOWN {
|
||||||
domain: domain,
|
domain,
|
||||||
qtype: qtype_num,
|
qtype: qtype_num,
|
||||||
data_len: data_len,
|
data_len,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,8 +362,8 @@ pub struct DnsQuestion {
|
|||||||
impl DnsQuestion {
|
impl DnsQuestion {
|
||||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||||
DnsQuestion {
|
DnsQuestion {
|
||||||
name: name,
|
name,
|
||||||
qtype: qtype,
|
qtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,9 +445,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::A {
|
Ok(DnsRecord::A {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::AAAA => {
|
QueryType::AAAA => {
|
||||||
@ -467,9 +467,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::AAAA {
|
Ok(DnsRecord::AAAA {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::NS => {
|
QueryType::NS => {
|
||||||
@ -477,9 +477,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut ns)?;
|
buffer.read_qname(&mut ns)?;
|
||||||
|
|
||||||
Ok(DnsRecord::NS {
|
Ok(DnsRecord::NS {
|
||||||
domain: domain,
|
domain,
|
||||||
host: ns,
|
host: ns,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::CNAME => {
|
QueryType::CNAME => {
|
||||||
@ -487,9 +487,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut cname)?;
|
buffer.read_qname(&mut cname)?;
|
||||||
|
|
||||||
Ok(DnsRecord::CNAME {
|
Ok(DnsRecord::CNAME {
|
||||||
domain: domain,
|
domain,
|
||||||
host: cname,
|
host: cname,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::MX => {
|
QueryType::MX => {
|
||||||
@ -498,20 +498,20 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut mx)?;
|
buffer.read_qname(&mut mx)?;
|
||||||
|
|
||||||
Ok(DnsRecord::MX {
|
Ok(DnsRecord::MX {
|
||||||
domain: domain,
|
domain,
|
||||||
priority: priority,
|
priority,
|
||||||
host: mx,
|
host: mx,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::UNKNOWN(_) => {
|
QueryType::UNKNOWN(_) => {
|
||||||
buffer.step(data_len as usize)?;
|
buffer.step(data_len as usize)?;
|
||||||
|
|
||||||
Ok(DnsRecord::UNKNOWN {
|
Ok(DnsRecord::UNKNOWN {
|
||||||
domain: domain,
|
domain,
|
||||||
qtype: qtype_num,
|
qtype: qtype_num,
|
||||||
data_len: data_len,
|
data_len,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,8 +362,8 @@ pub struct DnsQuestion {
|
|||||||
impl DnsQuestion {
|
impl DnsQuestion {
|
||||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||||
DnsQuestion {
|
DnsQuestion {
|
||||||
name: name,
|
name,
|
||||||
qtype: qtype,
|
qtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,9 +445,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::A {
|
Ok(DnsRecord::A {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::AAAA => {
|
QueryType::AAAA => {
|
||||||
@ -467,9 +467,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::AAAA {
|
Ok(DnsRecord::AAAA {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::NS => {
|
QueryType::NS => {
|
||||||
@ -477,9 +477,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut ns)?;
|
buffer.read_qname(&mut ns)?;
|
||||||
|
|
||||||
Ok(DnsRecord::NS {
|
Ok(DnsRecord::NS {
|
||||||
domain: domain,
|
domain,
|
||||||
host: ns,
|
host: ns,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::CNAME => {
|
QueryType::CNAME => {
|
||||||
@ -487,9 +487,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut cname)?;
|
buffer.read_qname(&mut cname)?;
|
||||||
|
|
||||||
Ok(DnsRecord::CNAME {
|
Ok(DnsRecord::CNAME {
|
||||||
domain: domain,
|
domain,
|
||||||
host: cname,
|
host: cname,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::MX => {
|
QueryType::MX => {
|
||||||
@ -498,20 +498,20 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut mx)?;
|
buffer.read_qname(&mut mx)?;
|
||||||
|
|
||||||
Ok(DnsRecord::MX {
|
Ok(DnsRecord::MX {
|
||||||
domain: domain,
|
domain,
|
||||||
priority: priority,
|
priority,
|
||||||
host: mx,
|
host: mx,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::UNKNOWN(_) => {
|
QueryType::UNKNOWN(_) => {
|
||||||
buffer.step(data_len as usize)?;
|
buffer.step(data_len as usize)?;
|
||||||
|
|
||||||
Ok(DnsRecord::UNKNOWN {
|
Ok(DnsRecord::UNKNOWN {
|
||||||
domain: domain,
|
domain,
|
||||||
qtype: qtype_num,
|
qtype: qtype_num,
|
||||||
data_len: data_len,
|
data_len,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,8 +362,8 @@ pub struct DnsQuestion {
|
|||||||
impl DnsQuestion {
|
impl DnsQuestion {
|
||||||
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
|
||||||
DnsQuestion {
|
DnsQuestion {
|
||||||
name: name,
|
name,
|
||||||
qtype: qtype,
|
qtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,9 +445,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::A {
|
Ok(DnsRecord::A {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::AAAA => {
|
QueryType::AAAA => {
|
||||||
@ -467,9 +467,9 @@ impl DnsRecord {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(DnsRecord::AAAA {
|
Ok(DnsRecord::AAAA {
|
||||||
domain: domain,
|
domain,
|
||||||
addr: addr,
|
addr,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::NS => {
|
QueryType::NS => {
|
||||||
@ -477,9 +477,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut ns)?;
|
buffer.read_qname(&mut ns)?;
|
||||||
|
|
||||||
Ok(DnsRecord::NS {
|
Ok(DnsRecord::NS {
|
||||||
domain: domain,
|
domain,
|
||||||
host: ns,
|
host: ns,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::CNAME => {
|
QueryType::CNAME => {
|
||||||
@ -487,9 +487,9 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut cname)?;
|
buffer.read_qname(&mut cname)?;
|
||||||
|
|
||||||
Ok(DnsRecord::CNAME {
|
Ok(DnsRecord::CNAME {
|
||||||
domain: domain,
|
domain,
|
||||||
host: cname,
|
host: cname,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::MX => {
|
QueryType::MX => {
|
||||||
@ -498,20 +498,20 @@ impl DnsRecord {
|
|||||||
buffer.read_qname(&mut mx)?;
|
buffer.read_qname(&mut mx)?;
|
||||||
|
|
||||||
Ok(DnsRecord::MX {
|
Ok(DnsRecord::MX {
|
||||||
domain: domain,
|
domain,
|
||||||
priority: priority,
|
priority,
|
||||||
host: mx,
|
host: mx,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QueryType::UNKNOWN(_) => {
|
QueryType::UNKNOWN(_) => {
|
||||||
buffer.step(data_len as usize)?;
|
buffer.step(data_len as usize)?;
|
||||||
|
|
||||||
Ok(DnsRecord::UNKNOWN {
|
Ok(DnsRecord::UNKNOWN {
|
||||||
domain: domain,
|
domain,
|
||||||
qtype: qtype_num,
|
qtype: qtype_num,
|
||||||
data_len: data_len,
|
data_len,
|
||||||
ttl: ttl,
|
ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user