mirror of
https://github.com/imsnif/bandwhich.git
synced 2026-02-09 01:59:18 +08:00
feat(interfaces): listen on all interfaces by default
Specifying an interface is now optional. The interface is shown in the connections table.
This commit is contained in:
@@ -64,7 +64,7 @@ impl<'a> Table<'a> {
|
||||
.iter()
|
||||
.map(|(connection, connection_data)| {
|
||||
vec![
|
||||
display_connection_string(&connection, &ip_to_host),
|
||||
display_connection_string(&connection, &ip_to_host, &connection_data.interface),
|
||||
connection_data.process_name.to_string(),
|
||||
display_upload_and_download(*connection_data),
|
||||
]
|
||||
|
||||
@@ -53,7 +53,11 @@ where
|
||||
write_to_stdout(format!(
|
||||
"connection: <{}> {} up/down Bps: {}/{} process: \"{}\"",
|
||||
timestamp,
|
||||
display_connection_string(connection, ip_to_host),
|
||||
display_connection_string(
|
||||
connection,
|
||||
ip_to_host,
|
||||
&connection_network_data.interface
|
||||
),
|
||||
connection_network_data.total_bytes_uploaded,
|
||||
connection_network_data.total_bytes_downloaded,
|
||||
connection_network_data.process_name
|
||||
|
||||
@@ -20,6 +20,7 @@ pub struct ConnectionData {
|
||||
pub total_bytes_downloaded: u128,
|
||||
pub total_bytes_uploaded: u128,
|
||||
pub process_name: String,
|
||||
pub interface: String,
|
||||
}
|
||||
|
||||
impl Bandwidth for ConnectionData {
|
||||
@@ -52,7 +53,7 @@ pub struct UIState {
|
||||
impl UIState {
|
||||
pub fn new(
|
||||
connections_to_procs: HashMap<Connection, String>,
|
||||
network_utilization: Utilization,
|
||||
mut network_utilization: Utilization,
|
||||
) -> Self {
|
||||
let mut processes: BTreeMap<String, NetworkData> = BTreeMap::new();
|
||||
let mut remote_addresses: BTreeMap<Ipv4Addr, NetworkData> = BTreeMap::new();
|
||||
@@ -60,32 +61,27 @@ impl UIState {
|
||||
let mut total_bytes_downloaded: u128 = 0;
|
||||
let mut total_bytes_uploaded: u128 = 0;
|
||||
for (connection, process_name) in connections_to_procs {
|
||||
if let Some(connection_bandwidth_utilization) =
|
||||
network_utilization.connections.get(&connection)
|
||||
{
|
||||
if let Some(connection_info) = network_utilization.connections.remove(&connection) {
|
||||
let data_for_remote_address = remote_addresses
|
||||
.entry(connection.remote_socket.ip)
|
||||
.or_default();
|
||||
let connection_data = connections.entry(connection).or_default();
|
||||
let data_for_process = processes.entry(process_name.clone()).or_default();
|
||||
|
||||
data_for_process.total_bytes_downloaded +=
|
||||
&connection_bandwidth_utilization.total_bytes_downloaded;
|
||||
data_for_process.total_bytes_uploaded +=
|
||||
&connection_bandwidth_utilization.total_bytes_uploaded;
|
||||
data_for_process.total_bytes_downloaded += connection_info.total_bytes_downloaded;
|
||||
data_for_process.total_bytes_uploaded += connection_info.total_bytes_uploaded;
|
||||
data_for_process.connection_count += 1;
|
||||
connection_data.total_bytes_downloaded +=
|
||||
&connection_bandwidth_utilization.total_bytes_downloaded;
|
||||
connection_data.total_bytes_uploaded +=
|
||||
&connection_bandwidth_utilization.total_bytes_uploaded;
|
||||
connection_data.total_bytes_downloaded += connection_info.total_bytes_downloaded;
|
||||
connection_data.total_bytes_uploaded += connection_info.total_bytes_uploaded;
|
||||
connection_data.process_name = process_name;
|
||||
connection_data.interface = connection_info.interface;
|
||||
data_for_remote_address.total_bytes_downloaded +=
|
||||
connection_bandwidth_utilization.total_bytes_downloaded;
|
||||
connection_info.total_bytes_downloaded;
|
||||
data_for_remote_address.total_bytes_uploaded +=
|
||||
connection_bandwidth_utilization.total_bytes_uploaded;
|
||||
connection_info.total_bytes_uploaded;
|
||||
data_for_remote_address.connection_count += 1;
|
||||
total_bytes_downloaded += connection_bandwidth_utilization.total_bytes_downloaded;
|
||||
total_bytes_uploaded += connection_bandwidth_utilization.total_bytes_uploaded;
|
||||
total_bytes_downloaded += connection_info.total_bytes_downloaded;
|
||||
total_bytes_uploaded += connection_info.total_bytes_uploaded;
|
||||
}
|
||||
}
|
||||
UIState {
|
||||
|
||||
23
src/main.rs
23
src/main.rs
@@ -36,7 +36,7 @@ use structopt::StructOpt;
|
||||
pub struct Opt {
|
||||
#[structopt(short, long)]
|
||||
/// The network interface to listen on, eg. eth0
|
||||
interface: String,
|
||||
interface: Option<String>,
|
||||
#[structopt(short, long)]
|
||||
/// Machine friendlier output
|
||||
raw: bool,
|
||||
@@ -78,8 +78,8 @@ fn try_main() -> Result<(), failure::Error> {
|
||||
}
|
||||
|
||||
pub struct OsInputOutput {
|
||||
pub network_interface: NetworkInterface,
|
||||
pub network_frames: Box<dyn DataLinkReceiver>,
|
||||
pub network_interfaces: Vec<NetworkInterface>,
|
||||
pub network_frames: Vec<Box<dyn DataLinkReceiver>>,
|
||||
pub get_open_sockets: fn() -> HashMap<Connection, String>,
|
||||
pub keyboard_events: Box<dyn Iterator<Item = Event> + Send>,
|
||||
pub dns_client: Option<dns::Client>,
|
||||
@@ -105,7 +105,13 @@ where
|
||||
|
||||
let raw_mode = opts.raw;
|
||||
|
||||
let mut sniffer = Sniffer::new(os_input.network_interface, os_input.network_frames);
|
||||
let mut sniffers = os_input
|
||||
.network_interfaces
|
||||
.into_iter()
|
||||
.zip(os_input.network_frames.into_iter())
|
||||
.map(|(iface, frames)| Sniffer::new(iface, frames))
|
||||
.collect::<Vec<Sniffer>>();
|
||||
|
||||
let network_utilization = Arc::new(Mutex::new(Utilization::new()));
|
||||
let ui = Arc::new(Mutex::new(Ui::new(terminal_backend)));
|
||||
|
||||
@@ -196,10 +202,13 @@ where
|
||||
active_threads.push(
|
||||
thread::Builder::new()
|
||||
.name("sniffing_handler".to_string())
|
||||
.spawn(move || {
|
||||
while running.load(Ordering::Acquire) {
|
||||
.spawn(move || 'sniffing: loop {
|
||||
for sniffer in sniffers.iter_mut() {
|
||||
if let Some(segment) = sniffer.next() {
|
||||
network_utilization.lock().unwrap().update(&segment)
|
||||
network_utilization.lock().unwrap().update(segment);
|
||||
}
|
||||
if !running.load(Ordering::Acquire) {
|
||||
break 'sniffing;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -52,9 +52,11 @@ pub fn display_ip_or_host(ip: Ipv4Addr, ip_to_host: &HashMap<Ipv4Addr, String>)
|
||||
pub fn display_connection_string(
|
||||
connection: &Connection,
|
||||
ip_to_host: &HashMap<Ipv4Addr, String>,
|
||||
interface: &str,
|
||||
) -> String {
|
||||
format!(
|
||||
":{} => {}:{} ({})",
|
||||
"<{}>:{} => {}:{} ({})",
|
||||
interface,
|
||||
connection.local_port,
|
||||
display_ip_or_host(connection.remote_socket.ip, ip_to_host),
|
||||
connection.remote_socket.port,
|
||||
|
||||
@@ -14,6 +14,7 @@ use ::std::net::{IpAddr, SocketAddr};
|
||||
use crate::network::{Connection, Protocol};
|
||||
|
||||
pub struct Segment {
|
||||
pub interface: String,
|
||||
pub connection: Connection,
|
||||
pub direction: Direction,
|
||||
pub data_length: u128,
|
||||
@@ -81,6 +82,7 @@ impl Sniffer {
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
let interface = self.network_interface.name.clone();
|
||||
let direction = Direction::new(&self.network_interface.ips, &ip_packet);
|
||||
let from = SocketAddr::new(IpAddr::V4(ip_packet.get_source()), source_port);
|
||||
let to = SocketAddr::new(IpAddr::V4(ip_packet.get_destination()), destination_port);
|
||||
@@ -90,6 +92,7 @@ impl Sniffer {
|
||||
Direction::Upload => Connection::new(to, source_port, protocol)?,
|
||||
};
|
||||
Some(Segment {
|
||||
interface,
|
||||
connection,
|
||||
data_length,
|
||||
direction,
|
||||
|
||||
@@ -3,14 +3,15 @@ use crate::network::{Connection, Direction, Segment};
|
||||
use ::std::collections::HashMap;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TotalBandwidth {
|
||||
pub struct ConnectionInfo {
|
||||
pub interface: String,
|
||||
pub total_bytes_downloaded: u128,
|
||||
pub total_bytes_uploaded: u128,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Utilization {
|
||||
pub connections: HashMap<Connection, TotalBandwidth>,
|
||||
pub connections: HashMap<Connection, ConnectionInfo>,
|
||||
}
|
||||
|
||||
impl Utilization {
|
||||
@@ -23,14 +24,15 @@ impl Utilization {
|
||||
self.connections.clear();
|
||||
clone
|
||||
}
|
||||
pub fn update(&mut self, seg: &Segment) {
|
||||
let total_bandwidth =
|
||||
self.connections
|
||||
.entry(seg.connection.clone())
|
||||
.or_insert(TotalBandwidth {
|
||||
total_bytes_downloaded: 0,
|
||||
total_bytes_uploaded: 0,
|
||||
});
|
||||
pub fn update(&mut self, seg: Segment) {
|
||||
let total_bandwidth = self
|
||||
.connections
|
||||
.entry(seg.connection)
|
||||
.or_insert(ConnectionInfo {
|
||||
interface: seg.interface,
|
||||
total_bytes_downloaded: 0,
|
||||
total_bytes_uploaded: 0,
|
||||
});
|
||||
match seg.direction {
|
||||
Direction::Download => {
|
||||
total_bandwidth.total_bytes_downloaded += seg.data_length;
|
||||
|
||||
@@ -34,11 +34,11 @@ fn get_datalink_channel(
|
||||
interface: &NetworkInterface,
|
||||
) -> Result<Box<dyn DataLinkReceiver>, failure::Error> {
|
||||
let mut config = Config::default();
|
||||
config.read_timeout = Some(time::Duration::new(0, 1));
|
||||
config.read_timeout = Some(time::Duration::new(0, 2_000_000));
|
||||
match datalink::channel(interface, config) {
|
||||
Ok(Ethernet(_tx, rx)) => Ok(rx),
|
||||
Ok(_) => failure::bail!("Unknown interface type"),
|
||||
Err(e) => failure::bail!("Failed to listen to network interface: {}", e),
|
||||
Err(e) => failure::bail!("Failed to listen on network interface: {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +76,27 @@ fn create_write_to_stdout() -> Box<dyn FnMut(String) + Send> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_input(interface_name: &str, resolve: bool) -> Result<OsInputOutput, failure::Error> {
|
||||
let keyboard_events = Box::new(KeyboardEvents);
|
||||
let network_interface = match get_interface(interface_name) {
|
||||
Some(interface) => interface,
|
||||
None => {
|
||||
failure::bail!("Cannot find interface {}", interface_name);
|
||||
pub fn get_input(
|
||||
interface_name: &Option<String>,
|
||||
resolve: bool,
|
||||
) -> Result<OsInputOutput, failure::Error> {
|
||||
let network_interfaces = if let Some(name) = interface_name {
|
||||
match get_interface(&name) {
|
||||
Some(interface) => vec![interface],
|
||||
None => {
|
||||
failure::bail!("Cannot find interface {}", name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
datalink::interfaces()
|
||||
};
|
||||
let network_frames = get_datalink_channel(&network_interface)?;
|
||||
|
||||
let network_frames = network_interfaces
|
||||
.iter()
|
||||
.map(|iface| get_datalink_channel(iface))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
let keyboard_events = Box::new(KeyboardEvents);
|
||||
let write_to_stdout = create_write_to_stdout();
|
||||
let (on_winch, cleanup) = sigwinch();
|
||||
let dns_client = if resolve {
|
||||
@@ -96,7 +108,7 @@ pub fn get_input(interface_name: &str, resolve: bool) -> Result<OsInputOutput, f
|
||||
};
|
||||
|
||||
Ok(OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::tests::fakes::{
|
||||
create_fake_dns_client, create_fake_on_winch, get_interface, get_open_sockets, KeyboardEvents,
|
||||
create_fake_dns_client, create_fake_on_winch, get_interfaces, get_open_sockets, KeyboardEvents,
|
||||
NetworkFrames, TestBackend,
|
||||
};
|
||||
|
||||
@@ -65,13 +65,13 @@ fn one_packet_of_traffic() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
let network_frames = vec![NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"1.1.1.1",
|
||||
443,
|
||||
12345,
|
||||
b"I am a fake tcp packet",
|
||||
))]);
|
||||
))])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -84,7 +84,7 @@ fn one_packet_of_traffic() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -98,7 +98,7 @@ fn one_packet_of_traffic() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -108,7 +108,7 @@ fn one_packet_of_traffic() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -125,7 +125,7 @@ fn bi_directional_traffic() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"1.1.1.1",
|
||||
@@ -140,7 +140,7 @@ fn bi_directional_traffic() {
|
||||
443,
|
||||
b"I am a fake tcp download packet",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -153,7 +153,7 @@ fn bi_directional_traffic() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -167,7 +167,7 @@ fn bi_directional_traffic() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -177,7 +177,7 @@ fn bi_directional_traffic() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -194,7 +194,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -209,7 +209,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
443,
|
||||
b"I come from 2.2.2.2",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -224,7 +224,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
);
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let stdout = Arc::new(Mutex::new(Vec::new()));
|
||||
let write_to_stdout = Box::new({
|
||||
@@ -236,7 +236,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
on_winch,
|
||||
@@ -246,7 +246,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -263,7 +263,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -278,7 +278,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
443,
|
||||
b"I've come from 1.1.1.1 too!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -291,7 +291,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -305,7 +305,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -315,7 +315,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -332,7 +332,7 @@ fn one_process_with_multiple_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -347,7 +347,7 @@ fn one_process_with_multiple_connections() {
|
||||
443,
|
||||
b"Funny that, I'm from 3.3.3.3",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -360,7 +360,7 @@ fn one_process_with_multiple_connections() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -374,7 +374,7 @@ fn one_process_with_multiple_connections() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -384,7 +384,7 @@ fn one_process_with_multiple_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -401,7 +401,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -430,7 +430,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -443,7 +443,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -457,7 +457,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -467,7 +467,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -484,7 +484,7 @@ fn multiple_connections_from_remote_address() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -499,7 +499,7 @@ fn multiple_connections_from_remote_address() {
|
||||
443,
|
||||
b"Me too, but on a different port",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -512,7 +512,7 @@ fn multiple_connections_from_remote_address() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -526,7 +526,7 @@ fn multiple_connections_from_remote_address() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -536,7 +536,7 @@ fn multiple_connections_from_remote_address() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -554,7 +554,7 @@ fn sustained_traffic_from_one_process() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -570,7 +570,7 @@ fn sustained_traffic_from_one_process() {
|
||||
443,
|
||||
b"Same here, but one second later",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -583,7 +583,7 @@ fn sustained_traffic_from_one_process() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -597,7 +597,7 @@ fn sustained_traffic_from_one_process() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -607,7 +607,7 @@ fn sustained_traffic_from_one_process() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -625,7 +625,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -655,7 +655,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
443,
|
||||
b"I come 3.3.3.3 one second later",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -668,7 +668,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -682,7 +682,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -692,7 +692,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -710,7 +710,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -768,7 +768,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -781,7 +781,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
@@ -795,7 +795,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -805,7 +805,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -823,7 +823,7 @@ fn traffic_with_host_names() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -881,7 +881,7 @@ fn traffic_with_host_names() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -894,7 +894,7 @@ fn traffic_with_host_names() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let mut ips_to_hostnames = HashMap::new();
|
||||
ips_to_hostnames.insert(
|
||||
IpAddr::V4("1.1.1.1".parse().unwrap()),
|
||||
@@ -921,7 +921,7 @@ fn traffic_with_host_names() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -931,7 +931,7 @@ fn traffic_with_host_names() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -949,7 +949,7 @@ fn no_resolve_mode() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -1007,7 +1007,7 @@ fn no_resolve_mode() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -1020,7 +1020,7 @@ fn no_resolve_mode() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let mut ips_to_hostnames = HashMap::new();
|
||||
ips_to_hostnames.insert(
|
||||
IpAddr::V4("1.1.1.1".parse().unwrap()),
|
||||
@@ -1047,7 +1047,7 @@ fn no_resolve_mode() {
|
||||
});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1057,7 +1057,7 @@ fn no_resolve_mode() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: true,
|
||||
no_resolve: true,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::tests::fakes::TerminalEvent::*;
|
||||
use crate::tests::fakes::{
|
||||
create_fake_dns_client, create_fake_on_winch, get_interface, get_open_sockets, KeyboardEvents,
|
||||
create_fake_dns_client, create_fake_on_winch, get_interfaces, get_open_sockets, KeyboardEvents,
|
||||
NetworkFrames, TestBackend,
|
||||
};
|
||||
|
||||
@@ -55,9 +55,9 @@ fn basic_startup() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
None, // sleep
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -70,14 +70,14 @@ fn basic_startup() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -87,7 +87,7 @@ fn basic_startup() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -110,13 +110,13 @@ fn one_packet_of_traffic() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
let network_frames = vec![NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"1.1.1.1",
|
||||
443,
|
||||
12345,
|
||||
b"I am a fake tcp packet",
|
||||
))]);
|
||||
))])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -129,14 +129,14 @@ fn one_packet_of_traffic() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -146,7 +146,7 @@ fn one_packet_of_traffic() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -172,7 +172,7 @@ fn bi_directional_traffic() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"1.1.1.1",
|
||||
@@ -187,7 +187,7 @@ fn bi_directional_traffic() {
|
||||
443,
|
||||
b"I am a fake tcp download packet",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -200,14 +200,14 @@ fn bi_directional_traffic() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
let cleanup = Box::new(|| {});
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -217,7 +217,7 @@ fn bi_directional_traffic() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -243,7 +243,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -258,7 +258,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
443,
|
||||
b"I come from 2.2.2.2",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -273,12 +273,12 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
);
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
on_winch,
|
||||
@@ -288,7 +288,7 @@ fn multiple_packets_of_traffic_from_different_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -314,7 +314,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -329,7 +329,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
443,
|
||||
b"I've come from 1.1.1.1 too!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -342,14 +342,14 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -359,7 +359,7 @@ fn multiple_packets_of_traffic_from_single_connection() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -385,7 +385,7 @@ fn one_process_with_multiple_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -400,7 +400,7 @@ fn one_process_with_multiple_connections() {
|
||||
443,
|
||||
b"Funny that, I'm from 3.3.3.3",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -413,14 +413,14 @@ fn one_process_with_multiple_connections() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -430,7 +430,7 @@ fn one_process_with_multiple_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -456,7 +456,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -485,7 +485,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -498,14 +498,14 @@ fn multiple_processes_with_multiple_connections() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -515,7 +515,7 @@ fn multiple_processes_with_multiple_connections() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -541,7 +541,7 @@ fn multiple_connections_from_remote_address() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -556,7 +556,7 @@ fn multiple_connections_from_remote_address() {
|
||||
443,
|
||||
b"Me too, but on a different port",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -569,14 +569,14 @@ fn multiple_connections_from_remote_address() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -586,7 +586,7 @@ fn multiple_connections_from_remote_address() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -613,7 +613,7 @@ fn sustained_traffic_from_one_process() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -629,7 +629,7 @@ fn sustained_traffic_from_one_process() {
|
||||
443,
|
||||
b"Same here, but one second later",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -642,14 +642,14 @@ fn sustained_traffic_from_one_process() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -659,7 +659,7 @@ fn sustained_traffic_from_one_process() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -686,7 +686,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -716,7 +716,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
443,
|
||||
b"I come 3.3.3.3 one second later",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -729,14 +729,14 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -746,7 +746,7 @@ fn sustained_traffic_from_multiple_processes() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -773,7 +773,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -831,7 +831,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -844,14 +844,14 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -861,7 +861,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -888,7 +888,7 @@ fn traffic_with_host_names() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -946,7 +946,7 @@ fn traffic_with_host_names() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -959,7 +959,7 @@ fn traffic_with_host_names() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let mut ips_to_hostnames = HashMap::new();
|
||||
ips_to_hostnames.insert(
|
||||
IpAddr::V4("1.1.1.1".parse().unwrap()),
|
||||
@@ -979,7 +979,7 @@ fn traffic_with_host_names() {
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -989,7 +989,7 @@ fn traffic_with_host_names() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1016,7 +1016,7 @@ fn no_resolve_mode() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"3.3.3.3",
|
||||
@@ -1074,7 +1074,7 @@ fn no_resolve_mode() {
|
||||
12345,
|
||||
b"10.0.0.2 forever!",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -1087,7 +1087,7 @@ fn no_resolve_mode() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let mut ips_to_hostnames = HashMap::new();
|
||||
ips_to_hostnames.insert(
|
||||
IpAddr::V4("1.1.1.1".parse().unwrap()),
|
||||
@@ -1107,7 +1107,7 @@ fn no_resolve_mode() {
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1117,7 +1117,7 @@ fn no_resolve_mode() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: true,
|
||||
};
|
||||
@@ -1143,13 +1143,13 @@ fn traffic_with_winch_event() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
let network_frames = vec![NetworkFrames::new(vec![Some(build_tcp_packet(
|
||||
"10.0.0.2",
|
||||
"1.1.1.1",
|
||||
443,
|
||||
12345,
|
||||
b"I am a fake tcp packet",
|
||||
))]);
|
||||
))])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -1162,14 +1162,14 @@ fn traffic_with_winch_event() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(true);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1179,7 +1179,7 @@ fn traffic_with_winch_event() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1206,7 +1206,7 @@ fn layout_full_width_under_30_height() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -1235,7 +1235,7 @@ fn layout_full_width_under_30_height() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(190));
|
||||
let terminal_height = Arc::new(Mutex::new(29));
|
||||
@@ -1248,14 +1248,14 @@ fn layout_full_width_under_30_height() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1265,7 +1265,7 @@ fn layout_full_width_under_30_height() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1291,7 +1291,7 @@ fn layout_under_150_width_full_height() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -1320,7 +1320,7 @@ fn layout_under_150_width_full_height() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(149));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -1333,14 +1333,14 @@ fn layout_under_150_width_full_height() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1350,7 +1350,7 @@ fn layout_under_150_width_full_height() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1376,7 +1376,7 @@ fn layout_under_150_width_under_30_height() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -1405,7 +1405,7 @@ fn layout_under_150_width_under_30_height() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(149));
|
||||
let terminal_height = Arc::new(Mutex::new(29));
|
||||
@@ -1418,14 +1418,14 @@ fn layout_under_150_width_under_30_height() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1435,7 +1435,7 @@ fn layout_under_150_width_under_30_height() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1461,7 +1461,7 @@ fn layout_under_120_width_full_height() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -1490,7 +1490,7 @@ fn layout_under_120_width_full_height() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(119));
|
||||
let terminal_height = Arc::new(Mutex::new(50));
|
||||
@@ -1503,14 +1503,14 @@ fn layout_under_120_width_full_height() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1520,7 +1520,7 @@ fn layout_under_120_width_full_height() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
@@ -1546,7 +1546,7 @@ fn layout_under_120_width_under_30_height() {
|
||||
None, // sleep
|
||||
Some(Event::Key(Key::Ctrl('c'))),
|
||||
]));
|
||||
let network_frames = NetworkFrames::new(vec![
|
||||
let network_frames = vec![NetworkFrames::new(vec![
|
||||
Some(build_tcp_packet(
|
||||
"1.1.1.1",
|
||||
"10.0.0.2",
|
||||
@@ -1575,7 +1575,7 @@ fn layout_under_120_width_under_30_height() {
|
||||
443,
|
||||
b"I'm partial to 4.4.4.4",
|
||||
)),
|
||||
]);
|
||||
])];
|
||||
|
||||
let terminal_width = Arc::new(Mutex::new(119));
|
||||
let terminal_height = Arc::new(Mutex::new(29));
|
||||
@@ -1588,14 +1588,14 @@ fn layout_under_120_width_under_30_height() {
|
||||
terminal_width,
|
||||
terminal_height,
|
||||
);
|
||||
let network_interface = get_interface();
|
||||
let network_interfaces = get_interfaces();
|
||||
let dns_client = create_fake_dns_client(HashMap::new());
|
||||
let on_winch = create_fake_on_winch(false);
|
||||
let cleanup = Box::new(|| {});
|
||||
let write_to_stdout = Box::new({ move |_output: String| {} });
|
||||
|
||||
let os_input = OsInputOutput {
|
||||
network_interface,
|
||||
network_interfaces,
|
||||
network_frames,
|
||||
get_open_sockets,
|
||||
keyboard_events,
|
||||
@@ -1605,7 +1605,7 @@ fn layout_under_120_width_under_30_height() {
|
||||
write_to_stdout,
|
||||
};
|
||||
let opts = Opt {
|
||||
interface: String::from("interface_name"),
|
||||
interface: Some(String::from("interface_name")),
|
||||
raw: false,
|
||||
no_resolve: false,
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ pub struct NetworkFrames {
|
||||
}
|
||||
|
||||
impl NetworkFrames {
|
||||
pub fn new(packets: Vec<Option<Vec<u8>>>) -> Box<Self> {
|
||||
pub fn new(packets: Vec<Option<Vec<u8>>>) -> Box<dyn DataLinkReceiver> {
|
||||
Box::new(NetworkFrames {
|
||||
packets,
|
||||
current_index: 0,
|
||||
@@ -135,14 +135,14 @@ pub fn get_open_sockets() -> HashMap<Connection, String> {
|
||||
open_sockets
|
||||
}
|
||||
|
||||
pub fn get_interface() -> NetworkInterface {
|
||||
NetworkInterface {
|
||||
pub fn get_interfaces() -> Vec<NetworkInterface> {
|
||||
vec![NetworkInterface {
|
||||
name: String::from("interface_name"),
|
||||
index: 42,
|
||||
mac: None,
|
||||
ips: vec![IpNetwork::V4("10.0.0.2".parse().unwrap())],
|
||||
flags: 42,
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
pub fn create_fake_on_winch(should_send_winch_event: bool) -> Box<OnSigWinch> {
|
||||
|
||||
Reference in New Issue
Block a user