
コマンドラインからの簡単で高速なファイル共有。このコードには、独自のインスタンスを作成するために必要なすべてのサーバーが含まれています。
Transfer.shは現在、S3(Amazon S3)、Gdrive(Google Drive)、Storj(Storj)プロバイダー、およびローカルファイルシステム(ローカル)をサポートしています。
@StefanBentenは、たまたまこのリポジトリのメンテナーであり、レポでソフトウェアのよく知られている公開インストールをホストしている人物です。
とにかく2つは無関係であり、リポジトリは、Pubblicインスタレーションのいずれにおいてもリクエストや問題を指示する場所ではありません。
セキュリティ上の理由により、リポジトリ内のソフトウェアのサードパーティの公開インストールは、リポジトリ自体で宣伝または言及されません。
私の公式の位置@Aspaccaは、リポジトリのメンテナーとして、ソフトウェアを使用する場合は、独自のインストールをホストする必要があるということです。
$ curl -v --upload-file ./hello.txt https://transfer.sh/hello.txt$ gpg --armor --symmetric --output - /tmp/hello.txt | curl --upload-file - https://transfer.sh/test.txt$ curl https://transfer.sh/1lDau/test.txt | gpg --decrypt --output /tmp/hello.txt$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal$ curl -X DELETE < X-Url-Delete Response Header URL > $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H " Max-Downloads: 1 " # Limit the number of downloads$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H " Max-Days: 1 " # Set the number of days before deletion$ curl --upload-file ./hello.txt https://your-transfersh-instance.tld/hello.txt -H " X-Encrypt-Password: test " # Encrypt the content sever side with AES265 using "test" as password$ curl https://your-transfersh-instance.tld/BAYh0/hello.txt -H " X-Decrypt-Password: test " # Decrypt the content sever side with AES265 using "test" as password URLは、ファイルの削除を要求するために使用され、応答ヘッダーとして返されました。
curl -sD - --upload-file ./hello.txt https://transfer.sh/hello.txt | grep -i -E ' transfer.sh|x-url-delete '
x-url-delete: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU
https://transfer.sh/hello.txt/BAYh0/hello.txtexamples.mdの適切な使用例を参照してください
直接ダウンロードリンクを作成します:
https://transfer.sh/1ldau/test.txt-> https://transfer.sh/get/1ldau/test.txt
インラインファイル:
https://transfer.sh/1ldau/test.txt-> https://transfer.sh/inline/1ldau/test.txt
| パラメーター | 説明 | 価値 | env |
|---|---|---|---|
| リスナー | httpに使用するポート(:80) | リスナー | |
| プロファイルリストナー | プロファイラーに使用するポート(:6060) | profile_listener | |
| FORCE-HTTPS | HTTPSにリダイレクトします | 間違い | force_https |
| TLS-Listener | HTTPSに使用するポート(:443) | tls_listener | |
| TLS-Listenerのみ | TLSリスナーのみを有効にするためのフラグ | tls_listener_only | |
| TLS-CERT-FILE | TLS証明書へのパス | TLS_CERT_FILE | |
| TLS-Private-Key | TLS秘密キーへのパス | tls_private_key | |
| http-auth-user | アップロード時の基本的なHTTP AUTHのユーザー | http_auth_user | |
| http-auth-pass | アップロード時に基本的なHTTP AUTHを渡します | http_auth_pass | |
| http-auth-htpasswd | アップロード時の基本的なHTTP AUTHのHTPASSWDファイルパス | http_auth_htpasswd | |
| http-auth-ip-whitelist | http authに挑戦することなくアップロードすることができるIPの分離されたIPSのリスト | http_auth_ip_whitelist | |
| IPホワイトリスト | サービスに接続できるIPSの分離されたリスト | ip_whitelist | |
| IPブラックリスト | サービスに接続することが許可されていないIPのコンマ分離リスト | IP_BLACKLIST | |
| 温度パス | TEMPフォルダーへのパス | システム温度 | temp_path |
| ウェブパス | 静的Webファイルへのパス(開発またはカスタムフロントエンド用) | web_path | |
| プロキシパス | パスプレフィックスサービスがプロキシの背後に実行されたとき | proxy_path | |
| プロキシポート | プロキシのポートサービスがプロキシの背後に実行されたとき | proxy_port | |
| 電子メール - コンタクト | フロントエンドについては、お問い合わせのお問い合わせがあります | email_contact | |
| ga-key | フロントエンドのGoogleアナリティクスキー | ga_key | |
| プロバイダー | どのストレージプロバイダーを使用するか | (S3、storj、gdriveまたはlocal) | |
| Uservoice-Key | フロントエンドのユーザー音声キー | uservoice_key | |
| AWS-Access-Key | AWSアクセスキー | AWS_ACCESS_KEY | |
| AWS-Secret-Key | AWSアクセスキー | AWS_SECRET_KEY | |
| バケツ | AWSバケツ | バケツ | |
| S3エンドポイント | カスタムS3エンドポイント。 | s3_endpoint | |
| S3地域 | S3バケットの領域 | Eu-West-1 | S3_REGION |
| S3-No-Multipart | S3マルチパートアップロードを無効にします | 間違い | s3_no_multipart |
| S3-PATHスタイル | ミニオに必要なパススタイルURLを強制します。 | 間違い | s3_path_style |
| storj-access | プロジェクトへのアクセス | storj_access | |
| Storj-Bucket | プロジェクト内で使用するバケット | storj_bucket | |
| Basedir | ローカル/gdriveプロバイダーのパスストレージ | Basedir | |
| gdrive-client-json-filepath | GDRIVEプロバイダーのOAUTHクライアントJSON構成へのパス | gdrive_client_json_filepath | |
| gdrive-local-config-path | gdriveプロバイダーのローカル転送を保存するパス | gdrive_local_config_path | |
| gdrive-chunk-size | メガバイトのGDRIVEアップロードのチャンクサイズは、使用可能なメモリ(8 MB)よりも低くなければなりません | gdrive_chunk_size | |
| lets-encrypt-hosts | Lets Encrypt Extermates(Comma Seperated)に使用するホスト | ホスト | |
| ログ | ログファイルへのパス | ログ | |
| corsドメイン | CORのドメインのコンマ分離リスト、CORSを有効に設定する | cors_domains | |
| クラマブホスト | クラマブ機能のホスト | clamav_host | |
| Perform-clamav-prescan | Clamav機能を介したすべてのアップロード(Clamav-Hostは地元のClamd Unixソケットでなければなりません) | perform_clamav_prescan | |
| レートリミット | 1分あたりのリクエスト | reate_limit | |
| Max-upload-size | キロバイトの最大アップロードサイズ | max_upload_size | |
| パージデイ | アップロード後の日数が自動的にパージされます | purge_days | |
| パージインターバル | 自動パージを実行するための時間の間隔(S3およびSTORJには適用されません) | purge_interval | |
| ランダムトークン長 | アップロードパスのランダムトークンの長さ(削除パスのサイズの2倍) | 6 | random_token_length |
LETS証明書を使用してTLSを使用する場合は、ドメインにLets-encrypt-Hostsを設定し、TLS-Listenerを443に設定し、Force-HTTPSを有効にします。
独自の証明書を使用してTLSを使用する場合は、TLS-Listenerを443、Force-HTTPS、TLS-Cert-File、TLS-Private-Keyに設定します。
go111moduleに切り替えました
go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/$ git clone [email protected]:dutchcoders/transfer.sh.git
$ cd transfer.sh
$ go build -o transfersh main.go簡単に展開するために、公式のDockerコンテナを作成しました。 2つのバリエーションがあり、ユーザーがプロセスを実行するだけで異なります。
デフォルトのものはrootとして実行されます:
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/接尾辞-norootでタグ付けされたものは、UIDとGIDの両方として5000使用します。
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest-noroot --provider local --basedir /tmp/自分でコンテナを構築することもできます。これにより、NFSマウントを使用する場合、どのUID/GIDが使用されるかを選択できます。
# Build arguments:
# * RUNAS: If empty, the container will run as root.
# Set this to anything to enable UID/GID selection.
# * PUID: UID of the process. Needs RUNAS != "". Defaults to 5000.
# * PGID: GID of the process. Needs RUNAS != "". Defaults to 5000.
docker build -t transfer.sh-noroot --build-arg RUNAS=doesntmatter --build-arg PUID=1337 --build-arg PGID=1338 . AWS S3バケットを使用して使用するには、次のオプションを指定するだけです。
--provider s3AWS_ACCESS_KEYを介して)AWS_SECRET_KEYを介して)BUCKET経由)S3_REGION経由)S3-regionを指定した場合、正しいエンドポイントが自動的に使用されるため、エンドポイントURLを設定する必要はありません。
カスタム非AWS S3プロバイダーを使用するには、クラウドプロバイダーから定義されているエンドポイントを指定する必要があります。
STORJネットワークをストレージプロバイダーとして使用するには、次のフラグを指定する必要があります。
--provider storjアクセス助成金を作成(または、アップリンク構成からコピー)と準備中のバケットを作成する必要があります。
開始するには、アカウントにログインしてアクセスグラントメニューに移動し、右上のウィザードを開始します。
アクセスグラントの選択名を入力し、次に押して、必要に応じて制限します。その後、CLIまたはブラウザ内で続行します。次に、暗号化キーとして使用されるパスフレーズを求められます。安全な場所に保存してください。それがなければ、ファイルを解読する能力が失われます!
その後、アクセス助成金をコピーしてから、Transfer.sh Endpointの起動を開始できます。強化されたセキュリティのためのENV変数として、アクセス助成金とバケット名の両方を提供することをお勧めします。
例:
export STORJ_BUCKET=<BUCKET NAME>
export STORJ_ACCESS=<ACCESS GRANT>
transfer.sh --provider storj
Googleドライブでの使用については、次のオプションを指定する必要があります。
console.cloud.google.comからOAuthクライアントIDを作成し、ファイルをダウンロードして、安全なディレクトリに配置する必要があります。
go run main.go --provider gdrive --basedir /tmp/ --gdrive-client-json-filepath /[credential_dir] --gdrive-local-config-path [directory_to_save_config]
transfer () (if [ $# -eq 0 ] ; then printf " No arguments specified.nUsage:n transfer <file|directory>n ... | transfer <file_name>n " >&2 ; return 1 ; fi ; file_name= $( basename " $1 " ) ; if [ -t 0 ] ; then file= " $1 " ; if [ ! -e " $file " ] ; then echo " $file : No such file or directory " >&2 ; return 1 ; fi ; if [ -d " $file " ] ; then cd " $file " || return 1 ; file_name= " $file_name .zip " ; set -- zip -r -q - . ; else set -- cat " $file " ; fi ; else set -- cat ; fi ; url= $( " $@ " | curl --silent --show-error --progress-bar --upload-file " - " " https://transfer.sh/ $file_name " ) ; echo " $url " ; ) $ transfer hello.txt
transfer ()
{
local file
declare -a file_array
file_array=( " ${ @ } " )
if [[ " ${file_array[@]} " == " " || " ${1} " == " --help " || " ${1} " == " -h " ]]
then
echo " ${0} - Upload arbitrary files to " transfer.sh " . "
echo " "
echo " Usage: ${0} [options] [<file>]... "
echo " "
echo " OPTIONS: "
echo " -h, --help "
echo " show this message "
echo " "
echo " EXAMPLES: "
echo " Upload a single file from the current working directory: "
echo " ${0} " image.img " "
echo " "
echo " Upload multiple files from the current working directory: "
echo " ${0} " image.img " " image2.img " "
echo " "
echo " Upload a file from a different directory: "
echo " ${0} " /tmp/some_file " "
echo " "
echo " Upload all files from the current working directory. Be aware of the webserver's rate limiting!: "
echo " ${0} * "
echo " "
echo " Upload a single file from the current working directory and filter out the delete token and download link: "
echo " ${0} " image.img " | awk --field-separator= " : " '/Delete token:/ { print $ 2 } /Download link:/ { print $ 2 }' "
echo " "
echo " Show help text from " transfer.sh " : "
echo " curl --request GET " https://transfer.sh " "
return 0
else
for file in " ${file_array[@]} "
do
if [[ ! -f " ${file} " ]]
then
echo -e " e[01;31m' ${file} ' could not be found or is not a file.e[0m " >&2
return 1
fi
done
unset file
fi
local upload_files
local curl_output
local awk_output
du -c -k -L " ${file_array[@]} " >&2
# be compatible with "bash"
if [[ " ${ZSH_NAME} " == " zsh " ]]
then
read $' upload_files? e [01;31mDo you really want to upload the above files ( ' " ${ # file_array[@]} " $' ) to "transfer.sh"? (Y/n): e [0m '
elif [[ " ${BASH} " == * " bash " * ]]
then
read -p $' e [01;31mDo you really want to upload the above files ( ' " ${ # file_array[@]} " $' ) to "transfer.sh"? (Y/n): e [0m ' upload_files
fi
case " ${upload_files :- y} " in
" y " | " Y " )
# for the sake of the progress bar, execute "curl" for each file.
# the parameters "--include" and "--form" will suppress the progress bar.
for file in " ${file_array[@]} "
do
# show delete link and filter out the delete token from the response header after upload.
# it is important to save "curl's" "stdout" via a subshell to a variable or redirect it to another command,
# which just redirects to "stdout" in order to have a sane output afterwards.
# the progress bar is redirected to "stderr" and is only displayed,
# if "stdout" is redirected to something; e.g. ">/dev/null", "tee /dev/null" or "| <some_command>".
# the response header is redirected to "stdout", so redirecting "stdout" to "/dev/null" does not make any sense.
# redirecting "curl's" "stderr" to "stdout" ("2>&1") will suppress the progress bar.
curl_output= $( curl --request PUT --progress-bar --dump-header - --upload-file " ${file} " " https://transfer.sh/ " )
awk_output= $( awk
' gsub("r", "", $0) && tolower($1) ~ /x-url-delete/
{
delete_link=$2;
print "Delete command: curl --request DELETE " """delete_link""";
gsub(".*/", "", delete_link);
delete_token=delete_link;
print "Delete token: " delete_token;
}
END{
print "Download link: " $0;
} ' <<< " ${curl_output} " )
# return the results via "stdout", "awk" does not do this for some reason.
echo -e " ${awk_output} n "
# avoid rate limiting as much as possible; nginx: too many requests.
if (( ${ # file_array[@]} > 4 ))
then
sleep 5
fi
done
;;
" n " | " N " )
return 1
;;
* )
echo -e " e[01;31mWrong input: ' ${upload_files} '.e[0m " >&2
return 1
esac
}$ ls -lh
total 20M
-rw-r--r-- 1 < some_username > < some_username > 10M Apr 4 21:08 image.img
-rw-r--r-- 1 < some_username > < some_username > 10M Apr 4 21:08 image2.img
$ transfer image *
10240K image2.img
10240K image.img
20480K total
Do you really want to upload the above files (2) to " transfer.sh " ? (Y/n):
# ####################################################################################################################################################################################################################################### 100.0%
Delete command: curl --request DELETE " https://transfer.sh/wJw9pz/image2.img/mSctGx7pYCId "
Delete token: mSctGx7pYCId
Download link: https://transfer.sh/wJw9pz/image2.img
# ####################################################################################################################################################################################################################################### 100.0%
Delete command: curl --request DELETE " https://transfer.sh/ljJc5I/image.img/nw7qaoiKUwCU "
Delete token: nw7qaoiKUwCU
Download link: https://transfer.sh/ljJc5I/image.img
$ transfer " image.img " | awk --field-separator= " : " ' /Delete token:/ { print $2 } /Download link:/ { print $2 } '
10240K image.img
10240K total
Do you really want to upload the above files (1) to " transfer.sh " ? (Y/n):
# ####################################################################################################################################################################################################################################### 100.0%
tauN5dE3fWJe
https://transfer.sh/MYkuqn/image.img貢献は大歓迎です。
Remco Verhoef
Uvis Grinfelds
アンドレア・スパッカ
ステファン・ベンテン
コードとドキュメントCopyright 2011-2018 Remco Verhoef。コードとドキュメントCopyright 2018-2020 Andrea Spacca。コードとドキュメント著作権2020-アンドレアスパッカとステファンベンテン。
MITライセンスに基づいてリリースされたコード。