Fixed conversion error

cli
E. Almqvist 2 years ago
parent 6d3e9f353e
commit 02818488d8
  1. 5
      src/ipv4.rs

@ -1,5 +1,5 @@
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::convert::TryInto;
use crate::util;
use anyhow::{anyhow, Result};
use convert_base::Convert;
@ -37,6 +37,9 @@ impl IPv4 {
// Reverse it so that we start from the top
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 {
id,
ip,

Loading…
Cancel
Save