Crates.io | stablessh |
lib.rs | stablessh |
version | 0.1.5 |
source | src |
created_at | 2024-03-23 01:24:28.615115 |
updated_at | 2024-03-23 14:43:09.424242 |
description | Keeps SSH on even when laptop is closed |
homepage | |
repository | |
max_upload_size | |
id | 1183097 |
size | 104,710 |
It keeps the SSH connection alive even if the laptop is closed, the network is switched, or the communication is not stability.
It is influenced by the following software, but differs in some respects.
For Mac(homebrew)
brew install hrntknr/tap/stablessh
For other platforms
cargo install stablessh
Host target
Port 2222
ProxyCommand stablessh client %h:%p
"remote.SSH.useLocalServer": false,
[Unit]
Description=stablessh Daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/stablessh server
[Install]
WantedBy=multi-user.target
> $ stablessh ctl conn list
id | name | last_active | pkt_buf
----------+------+-------------+---------
d01c1bbe | mba | in_use | 0
aba69f2a | mba | 6 | 0
> $ stablessh ctl conn kill aba69f2a
> $ stablessh ctl conn list
id | name | last_active | pkt_buf
----------+------+-------------+---------
d01c1bbe | mba | in_use | 0
> $ stablessh --help
Usage: stablessh <COMMAND>
Commands:
server
client
ctl
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
> $ stablessh client --help
Usage: stablessh client [OPTIONS] <TARGET>
Arguments:
<TARGET>
Options:
-i, --idle <IDLE> [default: 3]
-k, --keepalive <KEEPALIVE> [default: 1]
-b, --bufsize <BUFSIZE> [default: 32]
-4, --only-ipv4
-6, --only-ipv6
-h, --help Print help
> $ stablessh server --help
Usage: stablessh server [OPTIONS]
Options:
-i, --idle <IDLE> [default: 3]
-k, --keepalive <KEEPALIVE> [default: 1]
-b, --bufsize <BUFSIZE> [default: 18]
-t, --hold-timeout <HOLD_TIMEOUT> [default: 604800]
-c, --hold-collect-interval <HOLD_COLLECT_INTERVAL> [default: 60]
-l, --listen <LISTEN> [default: 0.0.0.0:2222]
-f, --forward <FORWARD> [default: localhost:22]
-h, --help Print help
StableSSH's main target is convenience over performance.
However, in light measurements, the performance was about 50% of that of ssh.
> $ scp ~/100m stablessh:
100m 100% 100MB 5.4MB/s 00:18
> $ scp ~/100m ssh:
100m 100% 100MB 11.3MB/s 00:08
bufsize specifies the bit size of the buffer. (upper limit 32)
The default value allows a packet to be buffered for 32-bit space, but it may consume infinite memory.
If memory usage is a concern, try reducing bufsize.
(max memory size) = 4096 * 2 ^ (bufsize) [byte]
bufsize | max memory |
---|---|
4 | 64K |
8 | 1M |
16 | 256M |
18 | 1G |
20 | 4G |
22 | 16G |
24 | 64G |
32 | 16T |