parent
31892b27fc
commit
bd7514ea84
3 changed files with 28 additions and 29 deletions
src
|
@ -1,9 +1,8 @@
|
|||
use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
use std::hash::Hash;
|
||||
use std::net::Ipv6Addr;
|
||||
use ipnet::{IpAdd, IpBitAnd, IpBitOr, IpSub};
|
||||
use ipnet::{IpBitOr, IpSub};
|
||||
use std::str::FromStr;
|
||||
use log::{error, warn};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
@ -36,7 +35,7 @@ impl InterfaceConfig {
|
|||
pub(crate) fn full_v6(&self, interface_name: &String, host_v6: Ipv6Addr) -> Result<Ipv6Addr, ()> {
|
||||
let host_range = Ipv6Addr::from(host_v6.saturating_sub(self.host_address));
|
||||
let interface_address = match self.interfaces.get(interface_name) {
|
||||
Some(address) => address.clone(),
|
||||
Some(address) => *address,
|
||||
None => {
|
||||
let err_msg = "Malformed IP in interfaces.toml";
|
||||
match connected_to_journal() {
|
||||
|
@ -55,7 +54,7 @@ impl Default for InterfaceConfig {
|
|||
fn default() -> Self {
|
||||
InterfaceConfig {
|
||||
host_address: Ipv6Addr::from_str("::").expect("Malformed literal in code"),
|
||||
interfaces: HashMap::from([(" ".to_string(), Ipv6Addr::from(0))]),
|
||||
interfaces: HashMap::from([(" ".to_owned(), Ipv6Addr::from(0))]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +71,9 @@ pub(crate) struct ZoneEntry {
|
|||
impl Default for ZoneEntry {
|
||||
fn default() -> Self {
|
||||
ZoneEntry {
|
||||
name: " ".to_string(),
|
||||
name: " ".to_owned(),
|
||||
r#type: vec![A, AAAA],
|
||||
interface: " ".to_string(),
|
||||
interface: " ".to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,9 +130,9 @@ impl ZoneConfig {
|
|||
impl Default for ZoneConfig {
|
||||
fn default() -> Self {
|
||||
ZoneConfig {
|
||||
email: " ".to_string(),
|
||||
name: " ".to_string(),
|
||||
id: " ".to_string(),
|
||||
email: " ".to_owned(),
|
||||
name: " ".to_owned(),
|
||||
id: " ".to_owned(),
|
||||
entries: vec![ZoneEntry::default()],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue