2

使用 go pipeline 大幅度提高 trzsz ( trz / tsz ) 传输速度,做比 rz / sz 好用的开...

 1 year ago
source link: https://www.v2ex.com/t/936600
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

使用 go pipeline 大幅度提高 trzsz ( trz / tsz ) 传输速度,做比 rz / sz 好用的开源工具。

  LonnyWong · 11 小时 3 分钟前 · 583 次点击

开源地址https://github.com/trzsz/trzsz-go

trzsz ( trz / tsz ) 是类似 rz / sz 的文件传输工具,支持 tmux ,支持目录,支持进度条,使用体验更友好…

为了支持 tmux ,在传输文件时使用了 base64 编码,这导致传输速度有点下降,因此做了以下优化:

1 、base64 增加了要传输的长度,于是引入压缩算法,要传输的长度就会短很多(已压缩的文件、图片和影视等除外)。

2 、在非 tmux 场景支持 -b 二进制传输,适用于已压缩的文件、图片和影视等。

3 、 [] 用多线程流水线,将读文件、压缩、base64 编码、发送、接收、base64 解码、解压缩、写文件等进行并行处理。这可以大幅度提高传输速度,但复杂度相对较高,一直到现在才在 golang 版实现了。

golang 流水线版本已提交到 github https://github.com/trzsz/trzsz-go ,欢迎大家用 go 1.20 编译试用。
暂时未正式发布,计划支持在跳板机使用 tmux 的场景,再一并发布。
我在 github readme 最下面留了个 QQ 群号,欢迎大家加群讨论。

参考文献:
1 、https://go.dev/blog/pipelines
2 、https://go.dev/blog/context


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK