blob: 0fd3f8676a81ffcc1c33aff34a91be03c63eb1cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# tunneltop
A tunnel manager in the familiar top style written with ncurses and asyncio.
![Image](tunneltop.png)
## Install
```sh
pip install tunneltop
```
## what it is
* a simple tunnel manager written in python that uses the standard library only(standard library only in python 3.11)
* it starts and manages the tunnels for you
* lets the user interactively manage the tunnels as well
* will reload the config file if it receives a `SIGHUP`
* it is intentionally written as simple and tunnel-agnostic
* may or may not work on windows(let me know if you test it on windows)
## toml file
tunneltop expects its config file to be at at `$HOME/.tunneltoprc`.
You can see an example config file below:</br>
```toml
[socks5ir]
address = "127.0.0.1"
port = 9997
command = "autossh -M 0 -N -D 9997 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l debian -p 22 100.100.100.101"
test_command = 'curl "%{http_code}" -k -I -4 --socks5 socks5h://127.0.0.1:9997 https://icanhazip.com'
test_command_result = "200"
test_interval = 300
test_timeout = 10
[socks5_3]
address = "127.0.0.1"
port = 9995
command = "autossh -M 0 -N -D 0.0.0.0:9995 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o VerifyHostKeyDNS=no -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l debian -p 2022 100.100.100.100"
test_command = 'curl "%{http_code}" -k -I -4 --socks5 socks5h://127.0.0.1:9995 https://icanhazip.com'
test_command_result = "200"
test_interval = 300
test_timeout = 10
```
The tunnel names must be unique.</br>
### address
Displays the address at which the tunnel is available at. It is a display-only option.</br>
### port
Displays the port at which the tunnel is available at. It is a display-only option.</br>
### command
The command used to start the tunnel.</br>
### test_command
The command used to test the state of the tunnel.</br>
### test_command_result
The expected result of the test command.</br>
### test_interval
How often should the `test_command` be run.</br>
### test_timeout
How long before the test is considered to have timed out.</br>
## keybindings
`j` and `k` move you up and down.</br>
`g` and `G`move you to the first or last tunnel.</br>
`s` toggles a tunnel from enabled to disabled or vice versa.</br>
`r` restarts a tunnel.</br>
To quit send a `SIGINT` or a `SIGTERM`. I'm working on improving this of course.</br>
tunneltop will reload its config file upon receiving a `SIGHUP` and apply the changes immediately if there are any.</br>
|