Skip to content

Commit 0d1c24f

Browse files
committed
merge imports
1 parent 1c07bf9 commit 0d1c24f

File tree

11 files changed

+92
-70
lines changed

11 files changed

+92
-70
lines changed

oryx-tui/src/app.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,27 @@ use ratatui::{
99
},
1010
Frame,
1111
};
12-
use std::sync::{Arc, Mutex};
13-
use std::time::Duration;
14-
use std::{error, thread};
12+
use std::{
13+
error,
14+
sync::{Arc, Mutex},
15+
thread,
16+
time::Duration,
17+
};
1518
use tui_big_text::{BigText, PixelSize};
1619

1720
use crate::alerts::alert::Alert;
1821
use crate::bandwidth::Bandwidth;
19-
use crate::filters::filter::Filter;
20-
use crate::filters::fuzzy::{self, Fuzzy};
22+
use crate::filters::{
23+
filter::Filter,
24+
fuzzy::{self, Fuzzy},
25+
};
2126
use crate::help::Help;
2227
use crate::interface::Interface;
2328
use crate::notification::Notification;
24-
use crate::packets::network::{IpPacket, IpProto};
25-
use crate::packets::packet::AppPacket;
29+
use crate::packets::{
30+
network::{IpPacket, IpProto},
31+
packet::AppPacket,
32+
};
2633
use crate::stats::Stats;
2734

2835
pub type AppResult<T> = std::result::Result<T, Box<dyn error::Error>>;

oryx-tui/src/ebpf.rs

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
use std::os::fd::AsRawFd;
2-
use std::sync::atomic::AtomicBool;
3-
use std::sync::Arc;
4-
use std::thread::spawn;
5-
use std::time::Duration;
6-
use std::{io, thread};
7-
8-
use aya::maps::ring_buf::RingBufItem;
9-
use aya::maps::{Array, MapData, RingBuf};
10-
use aya::programs::{tc, SchedClassifier, TcAttachType};
11-
use aya::{include_bytes_aligned, Bpf};
12-
use mio::{Events, Interest, Poll, Registry, Token};
13-
use oryx_common::protocols::Protocol;
14-
use oryx_common::RawPacket;
15-
16-
use crate::event::Event;
17-
use crate::notification::{Notification, NotificationLevel};
18-
use mio::event::Source;
19-
use mio::unix::SourceFd;
1+
use std::{
2+
io,
3+
os::fd::AsRawFd,
4+
sync::{atomic::AtomicBool, Arc},
5+
thread::{self, spawn},
6+
time::Duration,
7+
};
8+
9+
use aya::{
10+
include_bytes_aligned,
11+
maps::{ring_buf::RingBufItem, Array, MapData, RingBuf},
12+
programs::{tc, SchedClassifier, TcAttachType},
13+
Bpf,
14+
};
15+
use oryx_common::{protocols::Protocol, RawPacket};
16+
17+
use crate::{
18+
event::Event,
19+
notification::{Notification, NotificationLevel},
20+
};
21+
use mio::{event::Source, unix::SourceFd, Events, Interest, Poll, Registry, Token};
2022

2123
pub struct Ebpf;
2224

oryx-tui/src/event.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::app::AppResult;
2-
use crate::notification::Notification;
1+
use crate::{app::AppResult, notification::Notification};
32
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent};
4-
use std::thread;
5-
use std::time::{Duration, Instant};
3+
use std::{
4+
thread,
5+
time::{Duration, Instant},
6+
};
67

78
#[derive(Clone)]
89
pub enum Event {

oryx-tui/src/export.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
use std::fs::{create_dir, OpenOptions};
2-
use std::io::prelude::*;
3-
use std::os::unix::fs::chown;
1+
use std::{
2+
fs::{create_dir, OpenOptions},
3+
io::prelude::*,
4+
os::unix::fs::chown,
5+
};
46

5-
use crate::app::AppResult;
6-
use crate::packets::network::{IpPacket, IpProto};
7-
use crate::packets::packet::AppPacket;
7+
use crate::{
8+
app::AppResult,
9+
packets::{
10+
network::{IpPacket, IpProto},
11+
packet::AppPacket,
12+
},
13+
};
814

915
pub fn export(packets: &[AppPacket]) -> AppResult<()> {
1016
let uid = unsafe { libc::geteuid() };

oryx-tui/src/infos.rs

Whitespace-only changes.

oryx-tui/src/interface.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ use ratatui::{
88
};
99

1010
use std::{
11+
ffi::CStr,
1112
fs::{self},
1213
net::{IpAddr, Ipv4Addr, Ipv6Addr},
1314
path::PathBuf,
1415
};
1516

16-
use std::ffi::CStr;
17-
1817
use crate::app::FocusedBlock;
1918

2019
#[derive(Debug, Clone)]

oryx-tui/src/main.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
44
use std::io;
55

66
use clap::{crate_description, crate_version, Command};
7-
use oryx_tui::app::{App, AppResult, TICK_RATE};
8-
use oryx_tui::event::{Event, EventHandler};
9-
use oryx_tui::handler::handle_key_events;
10-
use oryx_tui::tui::Tui;
11-
use ratatui::backend::CrosstermBackend;
12-
use ratatui::Terminal;
7+
use oryx_tui::{
8+
app::{App, AppResult, TICK_RATE},
9+
event::{Event, EventHandler},
10+
handler::handle_key_events,
11+
tui::Tui,
12+
};
13+
use ratatui::{backend::CrosstermBackend, Terminal};
1314

1415
fn main() -> AppResult<()> {
1516
Command::new("oryx")

oryx-tui/src/packets/network.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use core::fmt::Display;
1+
use core::{
2+
fmt::Display,
3+
net::{Ipv4Addr, Ipv6Addr},
4+
};
25
use ratatui::{
36
layout::{Constraint, Direction, Layout, Rect},
47
style::{Style, Stylize},
@@ -7,8 +10,6 @@ use ratatui::{
710
Frame,
811
};
912

10-
use core::net::{Ipv4Addr, Ipv6Addr};
11-
1213
use super::transport::{TcpPacket, UdpPacket};
1314

1415
#[derive(Debug, Copy, Clone)]

oryx-tui/src/packets/packet.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
use core::fmt::Display;
2-
3-
use core::net::Ipv4Addr;
4-
use std::mem;
1+
use std::{fmt::Display, mem, net::Ipv4Addr};
52

63
use network_types::ip::IpHdr;
74
use oryx_common::{ProtoHdr, RawPacket};
85

9-
use super::link::{ArpPacket, ArpType, MacAddr};
10-
use super::network::{IcmpPacket, IcmpType, IpPacket, IpProto, Ipv4Packet, Ipv6Packet};
11-
use super::transport::{TcpPacket, UdpPacket};
6+
use super::{
7+
link::{ArpPacket, ArpType, MacAddr},
8+
network::{IcmpPacket, IcmpType, IpPacket, IpProto, Ipv4Packet, Ipv6Packet},
9+
transport::{TcpPacket, UdpPacket},
10+
};
1211

1312
#[derive(Debug, Copy, Clone)]
1413
pub enum AppPacket {

oryx-tui/src/stats.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
use dns_lookup::lookup_addr;
2-
use std::collections::HashMap;
3-
use std::net::{IpAddr, Ipv4Addr};
2+
use std::{
3+
collections::HashMap,
4+
net::{IpAddr, Ipv4Addr},
5+
};
46

5-
use ratatui::layout::{Alignment, Constraint, Direction, Flex, Layout, Rect};
6-
use ratatui::style::{Color, Style};
7-
use ratatui::text::Line;
87
use ratatui::{
8+
layout::{Alignment, Constraint, Direction, Flex, Layout, Rect},
9+
style::{Color, Style},
10+
text::Line,
911
widgets::{Bar, BarChart, BarGroup, Block, Padding},
1012
Frame,
1113
};
1214

13-
use crate::packets::network::{IpPacket, IpProto};
14-
use crate::packets::packet::AppPacket;
15+
use crate::packets::{
16+
network::{IpPacket, IpProto},
17+
packet::AppPacket,
18+
};
1519

1620
#[derive(Debug)]
1721
pub struct Stats {

oryx-tui/src/tui.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
use crate::app::{App, AppResult};
2-
use crate::event::EventHandler;
3-
use crate::ui;
4-
use crossterm::event::{DisableMouseCapture, EnableMouseCapture};
5-
use crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen};
6-
use ratatui::backend::Backend;
7-
use ratatui::Terminal;
8-
use std::io;
9-
use std::panic;
1+
use crate::{
2+
app::{App, AppResult},
3+
event::EventHandler,
4+
ui,
5+
};
6+
use crossterm::{
7+
event::{DisableMouseCapture, EnableMouseCapture},
8+
terminal::{self, EnterAlternateScreen, LeaveAlternateScreen},
9+
};
10+
use ratatui::{backend::Backend, Terminal};
11+
use std::{io, panic};
1012

1113
#[derive(Debug)]
1214
pub struct Tui<B: Backend> {

0 commit comments

Comments
 (0)