TUI Port Manager is a terminal user interface tool for interactively viewing and managing network ports and processes on a Linux system. It is built in Rust using the ratatui
and procfs
crates, with deep system integration.
- Interactive terminal user interface (TUI)
- Displays open TCP and UDP ports with associated processes and PIDs
- Search bar for filtering by port, process name, or state
- Vim-style navigation (
j
/k
for up/down) - Kill processes with
c
, with confirmation popup - Real-time refresh of network data
- Uses
/proc
viaprocfs
for system integration (no external tools like lsof required) - Theming support: Toggle between default and dark themes with
t
- Port sorting: Cycle sorting by port, process, protocol, or state with
s
- Protocol filtering: Cycle between TCP, UDP, or all ports with
p
- Filtered port list updates as you type
- Confirmation dialog for killing processes
j
/k
: Move selection down/up/
: Enter search modeEsc
orEnter
: Exit search modeBackspace
: Remove last character in searchc
: Kill selected process (with confirmation)q
: Quitt
: Toggle theme (default/dark)s
: Cycle port sorting (port, process, protocol, state)p
: Cycle protocol filter (all, TCP, UDP)
Run the interactive terminal UI:
cargo run
Navigate, search, and manage ports using the keybindings above.
Start the API server:
cd src/api
cargo run
Query open ports with advanced filtering:
# List all TCP ports
curl "http://localhost:8080/ports?protocol=TCP" | jq
# Filter by process name
curl "http://localhost:8080/ports?process_name=nginx" | jq
# Filter by port range
curl "http://localhost:8080/ports?port_start=8000&port_end=9000" | jq
Run Posting tests for the API:
cd src/api
posting default -c .
Start Prometheus and Grafana:
cd src/monitoring
docker compose up -d
Open Grafana at http://localhost:3000 and import the dashboard port_manager_advanced_dashboard.json
for live API metrics.
- Linux system
- Rust toolchain (
cargo
,rustc
)
Add screenshots here to showcase the UI and features.
This project provides a Rust-based port management tool and API server, with monitoring and visualization via Prometheus and Grafana.
- Reserve and release ports via API
- Rate limiting (10 requests per IP per minute)
- Prometheus metrics endpoint (
/metrics
) - Grafana dashboards for monitoring
- Docker Compose setup for Prometheus, Grafana, and Apache
- Posting YAML file for automated API testing
port-manager/
src/
main.rs # CLI/TUI or main app
api/ # API server code
Cargo.toml
src/
main.rs
reservation.rs
monitoring/
prometheus/
prometheus.yml
docker-compose.yml
Cargo.toml # Workspace config
cargo build --workspace
cargo run --manifest-path src/api/Cargo.toml
- Reserve a port:
POST /reserve
with JSON[port, service]
- Release a port:
POST /release
with JSONport
- Check status:
GET /status/{port}
- Metrics:
GET /metrics
Each IP is limited to 10 requests per minute. Exceeding this returns HTTP 429.
- Start monitoring stack:
cd src/monitoring docker compose up -d
- Prometheus: http://prometheus:9090
- Grafana: http://localhost:3000
- Use Posting tool with
tests/port_reservation_tests.posting.yaml
for automated API tests.
- Custom Prometheus metrics for reserve/release requests
- Grafana dashboards (see
port_manager_advanced_dashboard.json
)
PRs and issues welcome!
MIT