Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
maximizzar committed Feb 27, 2024
2 parents 632aa3a + 0c2833b commit 92536b4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 77 deletions.
114 changes: 41 additions & 73 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::net::Ipv6Addr;
use std::str::FromStr;
use ipnet::Ipv6Net;

pub(crate) fn get_ipv6_addresses_from_config(filepath: &'static str, ipv6_addresses: &mut Vec<Ipv6Net>, prefix_size: &u8) {
pub(crate) fn get_ipv6_addresses_from_config(filepath: &'static str, ipv6_addresses: &mut Vec<Ipv6Net>, prefix_size: u8) {
let bind_db_file = File::open(filepath)
.expect(&*format!("Bind DB File under {} not found.", filepath));
let reader = BufReader::new(bind_db_file);
Expand All @@ -14,7 +14,7 @@ pub(crate) fn get_ipv6_addresses_from_config(filepath: &'static str, ipv6_addres
continue;
}
let ipv6_str = line.as_ref().unwrap().split_whitespace().last().unwrap();
ipv6_addresses.push(Ipv6Net::new(Ipv6Addr::from_str(ipv6_str).unwrap(), *prefix_size).unwrap());
ipv6_addresses.push(Ipv6Net::new(Ipv6Addr::from_str(ipv6_str).unwrap(), prefix_size).unwrap());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use std::str::FromStr;

fn main() {
//new program
let prefix_size: u8 = 56;
let prefix_size: u8 = 64;
let mut ipv6_addresses: Vec<Ipv6Net> = vec![];

bind::get_ipv6_addresses_from_config("src/db.maximizzar.io", &mut ipv6_addresses, &prefix_size);
bind::get_ipv6_addresses_from_config("src/db.maximizzar.io", &mut ipv6_addresses, prefix_size);
for ipv6_address in ipv6_addresses {
println!("{}", ipv6_address);
}
Expand Down

0 comments on commit 92536b4

Please sign in to comment.