|
|
@ -1,5 +1,5 @@ |
|
|
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; |
|
|
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; |
|
|
|
|
|
|
|
use std::convert::TryInto; |
|
|
|
use crate::util; |
|
|
|
use crate::util; |
|
|
|
use anyhow::{anyhow, Result}; |
|
|
|
use anyhow::{anyhow, Result}; |
|
|
|
use convert_base::Convert; |
|
|
|
use convert_base::Convert; |
|
|
@ -37,6 +37,9 @@ impl IPv4 { |
|
|
|
// Reverse it so that we start from the top
|
|
|
|
// Reverse it so that we start from the top
|
|
|
|
ip = ip.into_iter().rev().collect(); |
|
|
|
ip = ip.into_iter().rev().collect(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// convert to array
|
|
|
|
|
|
|
|
let ip: [u8; 4] = ip.try_into().unwrap_or_else(|v: Vec<u8>| panic!("Unable to convert Vec to [u8; 4] for IPv4!")); |
|
|
|
|
|
|
|
|
|
|
|
Self { |
|
|
|
Self { |
|
|
|
id, |
|
|
|
id, |
|
|
|
ip, |
|
|
|
ip, |
|
|
|