Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong committed Jun 30, 2024
1 parent 3d60e97 commit 141018b
Show file tree
Hide file tree
Showing 2 changed files with 228 additions and 5 deletions.
145 changes: 145 additions & 0 deletions README.cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# tsshd

[![MIT License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://choosealicense.com/licenses/mit/)
[![GitHub Release](https://img.shields.io/github/v/release/trzsz/tsshd)](https://github.com/trzsz/tsshd/releases)

[`tssh --udp`](https://github.com/trzsz/trzsz-ssh) 类似于 [`mosh`](https://github.com/mobile-shell/mosh), 而 `tsshd` 类似于 `mosh-server`.

## 优点简介

- 低延迟( 基于 QUIC / KCP )

- 端口转发( 与 openssh 相同 )

## 如何使用

1. 在客户端(本地电脑)上安装 [tssh](https://github.com/trzsz/trzsz-ssh)

2. 在服务端(远程机器)上安装 [tsshd](https://github.com/trzsz/tsshd)

3. 使用 `tssh --udp` 登录服务器。如下配置可省略 `--udp` 参数:

```
Host xxx
#!! UdpMode yes
#!! TsshdPath ~/go/bin/tsshd
```

## 原理简介

- `tssh` 在客户端扮演 `ssh` 的角色,`tsshd` 在服务端扮演 `sshd` 的角色。

- `tssh` 会先作为一个 ssh 客户端正常登录到服务器上,然后在服务器上启动一个新的 `tsshd` 进程。

- `tsshd` 进程会随机侦听一个 61000 到 62000 之间的 UDP 端口,并将其端口和密钥通过 ssh 通道发回给 `tssh` 进程。登录的 ssh 连接会被关闭,然后 `tssh` 进程通过 UDP 与 `tsshd` 进程通讯。

- `tsshd` 支持 `QUIC` 协议和 `KCP` 协议(默认是 `QUIC` 协议),可以命令行指定(如 `-oUdpMode=KCP`),或如下配置:

```
Host xxx
#!! UdpMode KCP
```

## 安装方法

- Ubuntu 可用 apt 安装

<details><summary><code>sudo apt install tsshd</code></summary>

```sh
sudo apt update && sudo apt install software-properties-common
sudo add-apt-repository ppa:trzsz/ppa && sudo apt update

sudo apt install tsshd
```

</details>

- Debian 可用 apt 安装

<details><summary><code>sudo apt install tsshd</code></summary>

```sh
sudo apt install curl gpg
curl -s 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7074ce75da7cc691c1ae1a7c7e51d1ad956055ca' \
| gpg --dearmor -o /usr/share/keyrings/trzsz.gpg
echo 'deb [signed-by=/usr/share/keyrings/trzsz.gpg] https://ppa.launchpadcontent.net/trzsz/ppa/ubuntu jammy main' \
| sudo tee /etc/apt/sources.list.d/trzsz.list
sudo apt update

sudo apt install tsshd
```

</details>

- Linux 可用 yum 安装

<details><summary><code>sudo yum install tsshd</code></summary>

- 国内推荐使用 [wlnmp](https://www.wlnmp.com/install) 源,安装 tsshd 只需要添加 wlnmp 源( 配置 epel 源不是必须的 ):

```sh
curl -fsSL "https://sh.wlnmp.com/wlnmp.sh" | bash

sudo yum install tsshd
```

- 也可使用 [gemfury](https://gemfury.com/) 源( 只要网络通,所有操作系统通用 )

```sh
echo '[trzsz]
name=Trzsz Repo
baseurl=https://yum.fury.io/trzsz/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/trzsz.repo
sudo yum install tsshd
```

</details>

- ArchLinux 可用 [yay](https://github.com/Jguer/yay) 安装

<details><summary><code>yay -S tsshd</code></summary>

```sh
yay -Syu
yay -S tsshd
```

</details>

- 用 Go 直接安装( 要求 go 1.21 以上 )

<details><summary><code>go install github.com/trzsz/tsshd/cmd/tsshd@latest</code></summary>

```sh
go install github.com/trzsz/tsshd/cmd/tsshd@latest
```

安装后,`tsshd` 程序一般位于 `~/go/bin/` 目录下( Windows 一般在 `C:\Users\your_name\go\bin\` )。
</details>
- 用 Go 自己编译( 要求 go 1.21 以上 )
<details><summary><code>sudo make install</code></summary>
```sh
git clone --depth 1 https://github.com/trzsz/tsshd.git
cd tsshd
make
sudo make install
```

</details>

- 可从 [GitHub Releases](https://github.com/trzsz/tsshd/releases) 中下载,国内可从 [Gitee 发行版](https://gitee.com/trzsz/tsshd/releases) 中下载,解压并加到 `PATH` 环境变量中。

## 联系方式

有什么问题可以发邮件给作者 <[email protected]>,也可以提 [Issues](https://github.com/trzsz/tsshd/issues) 。欢迎加入 QQ 群:318578930。

## 赞助打赏

[❤️ 赞助 trzsz ❤️](https://github.com/trzsz),请作者喝杯咖啡 ☕ ? 谢谢您们的支持!
88 changes: 83 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# tsshd

[![MIT License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://choosealicense.com/licenses/mit/)
[![GitHub Release](https://img.shields.io/github/v/release/trzsz/tsshd)](https://github.com/trzsz/tsshd/releases)
[![中文文档](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E6%96%87%E6%A1%A3-blue?style=flat)](https://github.com/trzsz/tsshd/blob/main/README.cn.md)

The [`tssh --udp`](https://github.com/trzsz/trzsz-ssh) works like [`mosh`](https://github.com/mobile-shell/mosh), and the `tsshd` works like `mosh-server`.

## Advanced Features

- Low latency ( based on QUIC / KCP )

- Port forwarding ( same as ssh )
- Port forwarding ( same as openssh )

## How to use

1. Install [tssh](https://github.com/trzsz/trzsz-ssh) on the client ( the user's machine ).

2. Install [tsshd](https://github.com/trzsz/tsshd) on the server ( the remote host ).

3. Use `tssh --udp xxx` to login to the server. Configure as follows to omit `--udp`:
3. Use `tssh --udp` to login to the server. Configure as follows to omit `--udp`:

```
Host xxx
Expand All @@ -24,14 +28,88 @@ The [`tssh --udp`](https://github.com/trzsz/trzsz-ssh) works like [`mosh`](https

## How it works

The `tssh` plays the role of `ssh` on the client side, and the `tsshd` plays the role of `sshd` on the server side.
- The `tssh` plays the role of `ssh` on the client side, and the `tsshd` plays the role of `sshd` on the server side.

- The `tssh` will first login to the server normally as an ssh client, and then run a new `tsshd` process on the server.

- The `tsshd` process listens on a random udp port between 61000 and 62000, and sends its port number and a secret key back to the `tssh` process over the ssh channel. The ssh connection is then shut down, and the `tssh` process communicates with the `tsshd` process over udp.

The `tssh` will first login to the server normally as an ssh client, and then run a new `tsshd` process on the server.
- The `tsshd` supports `QUIC` protocol and `KCP` protocol (the default is `QUIC`), which can be specified on the command line (such as `-oUdpMode=KCP`), or configured as follows:

The `tsshd` process listens on a random udp port between 61000 and 62000, and sends its port number and a secret key back to the `tssh` process over the ssh channel. The ssh connection is then shut down, and the `tssh` process communicates with the `tsshd` process over udp.
```
Host xxx
#!! UdpMode KCP
```

## Installation

- Install with apt on Ubuntu

<details><summary><code>sudo apt install tsshd</code></summary>

```sh
sudo apt update && sudo apt install software-properties-common
sudo add-apt-repository ppa:trzsz/ppa && sudo apt update

sudo apt install tsshd
```

</details>

- Install with apt on Debian

<details><summary><code>sudo apt install tsshd</code></summary>

```sh
sudo apt install curl gpg
curl -s 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7074ce75da7cc691c1ae1a7c7e51d1ad956055ca' \
| gpg --dearmor -o /usr/share/keyrings/trzsz.gpg
echo 'deb [signed-by=/usr/share/keyrings/trzsz.gpg] https://ppa.launchpadcontent.net/trzsz/ppa/ubuntu jammy main' \
| sudo tee /etc/apt/sources.list.d/trzsz.list
sudo apt update

sudo apt install tsshd
```

</details>

- Install with yum on Linux

<details><summary><code>sudo yum install tsshd</code></summary>

- Install with [gemfury](https://gemfury.com/) repository.

```sh
echo '[trzsz]
name=Trzsz Repo
baseurl=https://yum.fury.io/trzsz/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/trzsz.repo

sudo yum install tsshd
```

- Install with [wlnmp](https://www.wlnmp.com/install) repository. It's not necessary to configure the epel repository for tsshd.
```sh
curl -fsSL "https://sh.wlnmp.com/wlnmp.sh" | bash
sudo yum install tsshd
```
</details>
- Install with [yay](https://github.com/Jguer/yay) on ArchLinux
<details><summary><code>yay -S tsshd</code></summary>
```sh
yay -Syu
yay -S tsshd
```
</details>
- Install with Go ( Requires go 1.21 or later )
<details><summary><code>go install github.com/trzsz/tsshd/cmd/tsshd@latest</code></summary>
Expand Down

0 comments on commit 141018b

Please sign in to comment.