Skip to content

Commit

Permalink
feat: Add immediate_process_tsig function for immediate TSIG processing
Browse files Browse the repository at this point in the history
  • Loading branch information
joalopez1206 committed Jul 17, 2024
1 parent 2e546aa commit b3fbfa6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tsig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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 std::time::SystemTime;
use crate::message::rclass::Rclass;
use crate::message::resource_record::{ResourceRecord, ToBytes};

Expand Down Expand Up @@ -379,6 +379,14 @@ pub fn process_tsig(msg: &DnsMessage, key:&[u8], key_name: String, time: u64,
(true, TsigErrorCode::NOERR)

}

pub fn immediate_process_tsig(msg: &DnsMessage, key:&[u8], key_name: String,
available_algorithm: Vec<(String, bool)>, mac_to_process: Vec<u8>) -> (bool, TsigErrorCode) {

let time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs();
process_tsig(msg, key, key_name, time, available_algorithm, mac_to_process)
}

//Auxiliar function to create the TSIG variables and resource recrods
#[doc= r"This function helps to set create a partial TSIG resource record on a DNS query"]
fn set_tsig_vars(alg_name: &str, name: &str, time_signed: u64, fudge: u16) -> ResourceRecord{
Expand Down

0 comments on commit b3fbfa6

Please sign in to comment.