summaryrefslogtreecommitdiffstats
path: root/src/tests/cases/raw_mode.rs
diff options
context:
space:
mode:
authorEduardo Broto <ebroto@tutanota.com>2019-12-10 22:53:48 +0100
committerEduardo Broto <ebroto@tutanota.com>2019-12-20 20:23:51 +0100
commit596889dbd3fa6cea2ce559bfd025fd3c2763056a (patch)
tree848a95da75459cda862935ef7dc097bb8388dd4b /src/tests/cases/raw_mode.rs
parent408ec397c81bb99d6727f01d5dc058e814012714 (diff)
feat(interfaces): listen on all interfaces by default
Specifying an interface is now optional. The interface is shown in the connections table.
Diffstat (limited to 'src/tests/cases/raw_mode.rs')
-rw-r--r--src/tests/cases/raw_mode.rs122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/tests/cases/raw_mode.rs b/src/tests/cases/raw_mode.rs
index f0989ca..54cea9e 100644
--- a/src/tests/cases/raw_mode.rs
+++ b/src/tests/cases/raw_mode.rs
@@ -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,
};