diff --git a/src/dnssec.rs b/src/dnssec.rs index 9af4fbb6..1b7ce88f 100644 --- a/src/dnssec.rs +++ b/src/dnssec.rs @@ -1,18 +1,17 @@ -pub mod dnssec_encryption; -pub mod dnssec_decryption; +pub mod dnssec; + use std::str::FromStr; use crate::domain_name::DomainName; -use crate::message::class_qclass::Qclass; -use crate::message::class_rclass::Rclass; +use crate::message::rclass::Rclass; use crate::message::DnsMessage; use crate::message::rdata::opt_rdata::OptRdata; use crate::message::rdata::Rdata; use crate::message::resource_record::{FromBytes, ResourceRecord, ToBytes}; -use crate::message::type_qtype::Qtype; use crate::message::rcode; use crate::message::rcode::Rcode; +use crate::message::rrtype::Rrtype; const EDNS_VERSION: u8 = 0; const REQUESTED_UDP_LEN: u16 = 4096; @@ -76,8 +75,8 @@ fn create_dns_message_with_dnssec(mut msg: DnsMessage) -> DnsMessage { fn see_dnssec_message() { let query = DnsMessage::new_query_message( DomainName::new_from_str("example.com"), - Qtype::A, - Qclass::UNKNOWN(4096), + Rrtype::A, + Rclass::UNKNOWN(4096), 1, true, 2000 diff --git a/src/tsig.rs b/src/tsig.rs index 89e94d3d..97010836 100644 --- a/src/tsig.rs +++ b/src/tsig.rs @@ -3,17 +3,19 @@ use std::fmt::{self,Display,Debug}; //aquí debe ir todo lo relacionado a la implementación de tsig como módulo use crypto::mac::MacResult; use crate::domain_name::DomainName; -use crate::message::class_qclass::{Qclass}; -use crate::message::class_rclass::Rclass; + +use crate::message::rclass::Rclass; use crate::message::resource_record::{ResourceRecord, ToBytes}; -use crate::message::type_qtype::Qtype; -use crate::message::{rdata::tsig_rdata::TSigRdata, DnsMessage, class_rclass}; + +use crate::message::{rdata::tsig_rdata::TSigRdata, DnsMessage,}; use crate::message::rdata::{tsig_rdata, Rdata}; use crypto::hmac::Hmac as crypto_hmac; use crypto::mac::Mac as crypto_mac; use hmac::{Hmac, Mac}; use crypto::{sha1::Sha1,sha2::Sha256}; use crate::message::rdata::a_rdata::ARdata; +use crate::message::rrtype::Rrtype; + type HmacSha256 = Hmac; @@ -83,7 +85,7 @@ pub fn get_digest_request(mac: Vec ,dns_msg: Vec, tsig_rr: ResourceRecor res.extend(tsig_rr.get_name().to_bytes()); //The below shifts are meant to correctly retreive theby //processing TSIG RR - let rclass_bytes: u16 = class_rclass::Rclass::from_rclass_to_int(tsig_rr.get_rclass()); + let rclass_bytes: u16 = Rclass::from_rclass_to_int(tsig_rr.get_rclass()); let rclass_ubyte = (rclass_bytes >> 8) as u8; let rclass_lbyte = rclass_bytes as u8; res.push(rclass_ubyte); @@ -601,8 +603,8 @@ fn check_signed_tsig() { //DNS message let mut q = DnsMessage::new_query_message( domain.clone(), - Qtype::A, - Qclass::ANY, + Rrtype::A, + Rclass::ANY, 0, false, id