TiDB-OPS

Transfer.sh – Easy and fast file sharing from the command-line.

介绍

从命令行轻松快速地共享文件。Transfer.sh 可直接启动一个文件共享服务器,使用 curl 命令发送数据 (HTTP 协议) 到 Transfer 服务器,通过 Transfer.sh 共享链接 (HTTP 协议) 下载数据。

Transfer.sh 支持 S3 协议的对象云存储 (Amazon S3)、谷歌网盘 (Google Drive)、系统本地存储 (local) 作为存储资源池。

安装

相关服务使用 Golang 编写
官方提供 docker images,通过 docker pull dutchcoders/transfer.sh 获取镜像,国内可使用 docker pull registry.docker-cn.com/dutchcoders/transfer.sh 获取镜像

Transfer.sh 命令行参数

Parameter Description Value Env
listener port to use for http (:80)    
profile-listener port to use for profiler (:6060)    
force-https redirect to https false  
tls-listener port to use for https (:443)    
tls-listener-only flag to enable tls listener only    
tls-cert-file path to tls certificate    
tls-private-key path to tls private key    
http-auth-user user for basic http auth on upload    
http-auth-pass pass for basic http auth on upload    
temp-path path to temp folder system temp  
web-path path to static web files (for development)    
ga-key google analytics key for the front end    
uservoice-key user voice key for the front end    
provider which storage provider to use (s3, grdrive or local)  
aws-access-key aws access key   AWS_ACCESS_KEY
aws-secret-key aws access key   AWS_SECRET_KEY
bucket aws bucket   BUCKET
basedir path storage for local/gdrive provider    
gdrive-client-json-filepath path to client json config for gdrive provider    
gdrive-local-config-path path to local transfer.sh config cache for gdrive provider    
lets-encrypt-hosts hosts to use for lets encrypt certificates (comma seperated)    
log path to log file    

SSL

如果要开启 SSL (默认使用 Let’s Encrypt 证书),需要开启 force-https 并设置 tls-listener 参数,默认 tls-listener 端口 443,需要根据 Let’s Encrypt 给的信息设置 lets-encrypt-hosts 参数

如果使用自己的 SSL 证书,需要设置 tls-listener 参数,默认为 :443 ;开启 force-https 参数,设置 tls-cert=file 与 tls-private-key 参数

使用测试

测试命令样例

该工具没有断点续传,请注意客户端与服务器端的网络质量

Upload:
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt

Encrypt & upload:
$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt

Download & decrypt:
$ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt

Upload to virustotal:
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal

Windows 可使用网页界面上传

如果是使用上面步骤的启动命令,可通过 http://IP:3000/ 打开网页,如下图

transfer-windows-upload

transfer-windows-upload

transfer-windows-upload

FAQ

Linux alias

添加到用户 .bashrc or .zshrc 文件内
添加完成后需要使用 source .bashrc or .zshrc 重新加载环境变量

transfer() {
    curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) | tee /dev/null;
}

alias transfer=transfer