Test latency for a single proxy (t) or all proxies in a group (T) concurrently. Shows animated spinner during testing and color-coded delay results (green < 200ms, yellow < 500ms, red >= 500ms/timeout). Test URL and timeout are configurable via TOML config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
86 lines
2.6 KiB
Markdown
86 lines
2.6 KiB
Markdown
# Clash TUI
|
|
|
|
A fullscreen terminal UI for controlling the [Clash](https://github.com/Dreamacro/clash) proxy manager API, built with Rust and [iocraft](https://github.com/ccbrown/iocraft).
|
|
|
|
## Features
|
|
|
|
- **Proxy selector** -- browse proxy groups in a two-pane layout, switch active proxies
|
|
- **Delay testing** -- test latency for a single proxy or all proxies in a group (concurrent)
|
|
- **Connections viewer** -- view active connections in a sortable table, close individual or all connections
|
|
- **Configurable keybindings** -- customize all shortcuts via TOML config
|
|
- **Periodic auto-refresh** -- configurable refresh interval (default 2s)
|
|
- **Mouse support** -- click tabs to switch views
|
|
|
|
## Configuration
|
|
|
|
Config file: `~/.config/clash_tui/config.toml`
|
|
|
|
```toml
|
|
clash_api_url = "http://127.0.0.1:9090"
|
|
clash_api_secret = "your-secret" # optional
|
|
refresh_interval = 2 # seconds
|
|
test_delay_url = "http://www.gstatic.com/generate_204"
|
|
test_delay_timeout = 5000 # milliseconds
|
|
|
|
[keybindings]
|
|
quit = "q"
|
|
tab_next = "Tab"
|
|
tab_prev = "BackTab"
|
|
up = "Up"
|
|
down = "Down"
|
|
left = "Left"
|
|
right = "Right"
|
|
select = "Enter"
|
|
close_connection = "d"
|
|
close_all_connections = "shift+d"
|
|
refresh = "r"
|
|
test_delay = "t"
|
|
test_delay_all = "shift+t"
|
|
```
|
|
|
|
All keybindings and settings are optional and use the defaults shown above.
|
|
|
|
## CLI Usage
|
|
|
|
```
|
|
cargo run -- [OPTIONS]
|
|
|
|
Options:
|
|
--api-address <URL> Override Clash API address
|
|
--api-secret <KEY> Override Clash API secret
|
|
--refresh-interval <SECS> Override refresh interval
|
|
```
|
|
|
|
CLI arguments override config file values.
|
|
|
|
## Default Keybindings
|
|
|
|
| Key | Action |
|
|
|-----------|-----------------------|
|
|
| `q` | Quit |
|
|
| `Tab` | Next tab |
|
|
| `BackTab` | Previous tab |
|
|
| `Up/Down` | Navigate list |
|
|
| `Left` | Switch to groups pane |
|
|
| `Right` | Switch to members pane|
|
|
| `Enter` | Select proxy |
|
|
| `t` | Test delay (selected) |
|
|
| `T` | Test delay (all) |
|
|
| `d` | Close connection |
|
|
| `D` | Close all connections |
|
|
| `r` | Force refresh |
|
|
|
|
## File Structure
|
|
|
|
```
|
|
src/
|
|
main.rs -- Entry point, CLI parsing, config loading
|
|
config.rs -- Config structs, TOML loading, CLI merging
|
|
keybindings.rs -- KeyBinding parsing and matching
|
|
clash.rs -- Clash API client + serde types
|
|
app.rs -- Root App component (fullscreen, tabs)
|
|
tab_bar.rs -- Clickable tab bar component
|
|
proxy_view.rs -- Proxy selector (two-pane layout)
|
|
connections_view.rs -- Connections table view
|
|
```
|