Skip to content

Commit

Permalink
fix: prefix_size by value
Browse files Browse the repository at this point in the history
  • Loading branch information
maximizzar committed Dec 22, 2023
1 parent 754b157 commit 0c2833b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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 0c2833b

Please sign in to comment.