适用场景:文件回传
Server部署
go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
[transfer.sh]2020/07/01 22:00:40 Transfer.sh server started.
using temp folder: /tmp/
using storage provider: local
[transfer.sh]2020/07/01 22:00:40 listening on port: :8080
[transfer.sh]2020/07/01 22:00:40 ---------------------------
transfer.exe --provider=local --listener :8080 --temp-path=C:\Users\XXX\Desktop\tmp --basedir=C:\Users\XXX\Desktop\tmp\
[transfer.sh]2020/07/01 15:51:43 Transfer.sh server started.
using temp folder: C:\Users\XXX\Desktop\tmp\
using storage provider: local
[transfer.sh]2020/07/01 15:51:43 listening on port: :8080
[transfer.sh]2020/07/01 15:51:43 ---------------------------
./transfer --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
[transfer.sh]2020/07/01 22:11:37 Transfer.sh server started.
using temp folder: /tmp/
using storage provider: local
[transfer.sh]2020/07/01 22:11:37 listening on port: :8080
[transfer.sh]2020/07/01 22:11:37 ---------------------------
其它参数
--listener value 127.0.0.1:8080 (default: "127.0.0.1:8080") [$LISTENER]
--profile-listener value 127.0.0.1:6060 [$PROFILE_LISTENER]
--force-https [$FORCE_HTTPS]
--tls-listener value 127.0.0.1:8443 [$TLS_LISTENER]
--tls-listener-only [$TLS_LISTENER_ONLY]
--tls-cert-file value [$TLS_CERT_FILE]
--tls-private-key value [$TLS_PRIVATE_KEY]
--temp-path value path to temp files (default: "/tmp") [$TEMP_PATH]
--web-path value path to static web files [$WEB_PATH]
--proxy-path value path prefix when service is run behind a proxy [$PROXY_PATH]
--ga-key value key for google analytics (front end) [$GA_KEY]
--uservoice-key value key for user voice (front end) [$USERVOICE_KEY]
--provider value s3|gdrive|local [$PROVIDER]
--s3-endpoint value [$S3_ENDPOINT]
--s3-region value (default: "eu-west-1") [$S3_REGION]
--aws-access-key value [$AWS_ACCESS_KEY]
--aws-secret-key value [$AWS_SECRET_KEY]
--bucket value [$BUCKET]
--s3-no-multipart Disables S3 Multipart Puts [$S3_NO_MULTIPART]
--s3-path-style Forces path style URLs, required for Minio. [$S3_PATH_STYLE]
--gdrive-client-json-filepath value [$GDRIVE_CLIENT_JSON_FILEPATH]
--gdrive-local-config-path value [$GDRIVE_LOCAL_CONFIG_PATH]
--gdrive-chunk-size value (default: 16) [$GDRIVE_CHUNK_SIZE]
--rate-limit value requests per minute (default: 0) [$RATE_LIMIT]
--lets-encrypt-hosts value host1, host2 [$HOSTS]
--log value /var/log/transfersh.log [$LOG]
--basedir value path to storage [$BASEDIR]
--clamav-host value clamav-host [$CLAMAV_HOST]
--virustotal-key value virustotal-key [$VIRUSTOTAL_KEY]
--profiler enable profiling [$PROFILER]
--http-auth-user value user for http basic auth [$HTTP_AUTH_USER]
--http-auth-pass value pass for http basic auth [$HTTP_AUTH_PASS]
--ip-whitelist value comma separated list of ips allowed to connect to the service [$IP_WHITELIST]
--ip-blacklist value comma separated list of ips not allowed to connect to the service [$IP_BLACKLIST]
--cors-domains value comma separated list of domains allowed for CORS requests [$CORS_DOMAINS]
--help, -h show help
--version, -v print the version
即使借助go语言特性,它可以轻松部署在公网,但在某些需求下,我们依然希望其仓库安全的留在本地,可搭配frp使用。
#配合frp
[transfer]
type = tcp
local_ip = 127.0.0.1
local_port = 8080
remote_port = 8080
Usage
# Uploading is easy using curl
$ curl --upload-file ./hello.txt http://127.0.0.1:8080/hello.txt
http://127.0.0.1:8080/66nb8/hello.txt
$ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt http://127.0.0.1:8080/hello.txt
http://127.0.0.1:8080/66nb8/hello.txt
# Download the file
$ curl http://127.0.0.1:8080/66nb8/hello.txt -o hello.txt
网友评论