RustNet
A cross-platform network monitoring tool built with Rust and TUI interface.
Features
- Monitor active network connections (TCP, UDP)
- View connection details (state, traffic, age)
- Identify processes associated with connections
- Display geographical information about remote IPs
- Cross-platform support (Linux, Windows, macOS)
- Terminal user interface with keyboard navigation
- Internationalization support
Installation
Prerequisites
- Rust and Cargo (install from rustup.rs)
- For GeoIP lookup: MaxMind GeoLite2 City database (place
GeoLite2-City.mmdbin the application directory)
Building from source
# Clone the repository
git clone https://github.com/yourusername/rustnet.git
cd rustnet
# Build in release mode
cargo build --release
# The executable will be in target/release/rustnet
Usage
# Run with default settings
rustnet
# Specify network interface
rustnet -i eth0
# Use a custom configuration file
rustnet -c /path/to/config.yml
# Set interface language
rustnet -l fr
Keyboard Controls
qorCtrl+C: Quit the applicationr: Refresh connections↑/k,↓/j: Navigate up/downEnter: View detailed information about a connectionEsc: Go back to previous viewp: View process details (when viewing connection details)l: Toggle IP location displayh: Toggle help screen
Configuration
RustNet can be configured using a YAML configuration file. The application searches for the configuration file in the following locations:
- Path specified with
-cor--config $XDG_CONFIG_HOME/rustnet/config.yml~/.config/rustnet/config.yml./config.yml(current directory)
Example configuration:
# Network interface to monitor (leave empty for default)
interface: eth0
# Interface language (ISO code: en, fr, ...)
language: en
# Path to MaxMind GeoIP database
geoip_db_path: /usr/share/GeoIP/GeoLite2-City.mmdb
# Refresh interval in milliseconds
refresh_interval: 1000
# Show IP locations (requires MaxMind DB)
show_locations: true
Internationalization
RustNet supports multiple languages. The application looks for language files in the following locations:
./i18n/[language].yml(current directory)$XDG_DATA_HOME/rustnet/i18n/[language].yml~/.local/share/rustnet/i18n/[language].yml/usr/share/rustnet/i18n/[language].yml
Currently supported languages:
- English (en)
- French (fr)
To add a new language, create a copy of i18n/en.yml, translate the values, and save it with the appropriate language code (e.g., de.yml for German).
Advanced Usage
Finding Process Information
RustNet attempts to identify the process associated with each network connection using different methods depending on the operating system:
- Linux: Uses
sscommand,netstat, or parses/procdirectly - Windows: Uses
netstatcommand or Windows API - macOS: Uses
lsofcommand ornetstat
GeoIP Lookup
When a MaxMind GeoLite2 City database is available, RustNet can display geographical information about remote IP addresses. To use this feature:
- Download the GeoLite2 City database from MaxMind (requires free account)
- Place the
GeoLite2-City.mmdbfile in one of the search paths (see configuration) - Enable IP location display with the
lkey
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.