You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 8.5 KiB

3 years ago
9 years ago
9 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
7 years ago
7 years ago
9 years ago
7 years ago
3 years ago
3 years ago
7 years ago
4 years ago
7 years ago
5 years ago
9 years ago
5 years ago
3 years ago
9 years ago
7 years ago
4 years ago
4 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. # transfer.sh [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dutchcoders/transfer.sh?utm_source=badge&utm_medium=badge&utm_campaign=&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/dutchcoders/transfer.sh)](https://goreportcard.com/report/github.com/dutchcoders/transfer.sh) [![Docker pulls](https://img.shields.io/docker/pulls/dutchcoders/transfer.sh.svg)](https://hub.docker.com/r/dutchcoders/transfer.sh/) [![Build Status](https://travis-ci.com/dutchcoders/transfer.sh.svg?branch=master)](https://travis-ci.com/dutchcoders/transfer.sh)
  2. Easy and fast file sharing from the command-line. This code contains the server with everything you need to create your own instance.
  3. Transfer.sh currently supports the s3 (Amazon S3), gdrive (Google Drive) providers, and local file system (local).
  4. ## Disclaimer
  5. This project repository has no relation with the service at https://transfer.sh that's managed by https://storj.io.
  6. So far we cannot address any issue related to the service at https://transfer.sh.
  7. The service at https://transfersh.com is of unknown origin and reported as cloud malware.
  8. ## Usage
  9. ### Upload:
  10. ```bash
  11. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
  12. ```
  13. ### Encrypt & upload:
  14. ```bash
  15. $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt
  16. ````
  17. ### Download & decrypt:
  18. ```bash
  19. $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
  20. ```
  21. ### Upload to virustotal:
  22. ```bash
  23. $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
  24. ```
  25. ### Deleting
  26. ```bash
  27. $ curl -X DELETE <X-Url-Delete Response Header URL>
  28. ```
  29. ## Request Headers
  30. ### Max-Downloads
  31. ```bash
  32. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Downloads: 1" # Limit the number of downloads
  33. ```
  34. ### Max-Days
  35. ```bash
  36. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Days: 1" # Set the number of days before deletion
  37. ```
  38. ## Response Headers
  39. ### X-Url-Delete
  40. The URL used to request the deletion of a file. Returned as a response header.
  41. ```bash
  42. curl -sD - --upload-file ./hello https://transfer.sh/hello.txt | grep 'X-Url-Delete'
  43. X-Url-Delete: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU
  44. ```
  45. ## Examples
  46. See good usage examples on [examples.md](examples.md)
  47. ## Link aliases
  48. Create direct download link:
  49. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt
  50. Inline file:
  51. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt
  52. ## Usage
  53. Parameter | Description | Value | Env
  54. --- | --- | --- | ---
  55. listener | port to use for http (:80) | | LISTENER |
  56. profile-listener | port to use for profiler (:6060) | | PROFILE_LISTENER |
  57. force-https | redirect to https | false | FORCE_HTTPS
  58. tls-listener | port to use for https (:443) | | TLS_LISTENER |
  59. tls-listener-only | flag to enable tls listener only | | TLS_LISTENER_ONLY |
  60. tls-cert-file | path to tls certificate | | TLS_CERT_FILE |
  61. tls-private-key | path to tls private key | | TLS_PRIVATE_KEY |
  62. http-auth-user | user for basic http auth on upload | | HTTP_AUTH_USER |
  63. http-auth-pass | pass for basic http auth on upload | | HTTP_AUTH_PASS |
  64. ip-whitelist | comma separated list of ips allowed to connect to the service | | IP_WHITELIST |
  65. ip-blacklist | comma separated list of ips not allowed to connect to the service | | IP_BLACKLIST |
  66. temp-path | path to temp folder | system temp | TEMP_PATH |
  67. web-path | path to static web files (for development or custom front end) | | WEB_PATH |
  68. proxy-path | path prefix when service is run behind a proxy | | PROXY_PATH |
  69. proxy-port | port of the proxy when the service is run behind a proxy | | PROXY_PORT |
  70. ga-key | google analytics key for the front end | | GA_KEY |
  71. provider | which storage provider to use | (s3, storj, gdrive or local) |
  72. uservoice-key | user voice key for the front end | | USERVOICE_KEY |
  73. aws-access-key | aws access key | | AWS_ACCESS_KEY |
  74. aws-secret-key | aws access key | | AWS_SECRET_KEY |
  75. bucket | aws bucket | | BUCKET |
  76. s3-endpoint | Custom S3 endpoint. | | S3_ENDPOINT |
  77. s3-region | region of the s3 bucket | eu-west-1 | S3_REGION |
  78. s3-no-multipart | disables s3 multipart upload | false | S3_NO_MULTIPART |
  79. s3-path-style | Forces path style URLs, required for Minio. | false | S3_PATH_STYLE |
  80. storj-access | Access for the project | | STORJ_ACCESS |
  81. storj-bucket | Bucket to use within the project | | STORJ_BUCKET |
  82. basedir | path storage for local/gdrive provider | | BASEDIR |
  83. gdrive-client-json-filepath | path to oauth client json config for gdrive provider | | GDRIVE_CLIENT_JSON_FILEPATH |
  84. gdrive-local-config-path | path to store local transfer.sh config cache for gdrive provider| | GDRIVE_LOCAL_CONFIG_PATH |
  85. gdrive-chunk-size | chunk size for gdrive upload in megabytes, must be lower than available memory (8 MB) | | GDRIVE_CHUNK_SIZE |
  86. lets-encrypt-hosts | hosts to use for lets encrypt certificates (comma seperated) | | HOSTS |
  87. log | path to log file| | LOG |
  88. cors-domains | comma separated list of domains for CORS, setting it enable CORS | | CORS_DOMAINS |
  89. clamav-host | host for clamav feature | | CLAMAV_HOST |
  90. rate-limit | request per minute | | RATE_LIMIT |
  91. max-upload-size | max upload size in kilobytes | | MAX_UPLOAD_SIZE |
  92. purge-days | number of days after the uploads are purged automatically | | PURGE_DAYS |
  93. purge-interval | interval in hours to run the automatic purge for (not applicable to S3 and Storj) | | PURGE_INTERVAL |
  94. If you want to use TLS using lets encrypt certificates, set lets-encrypt-hosts to your domain, set tls-listener to :443 and enable force-https.
  95. If you want to use TLS using your own certificates, set tls-listener to :443, force-https, tls-cert-file and tls-private-key.
  96. ## Development
  97. Switched to GO111MODULE
  98. ```bash
  99. go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
  100. ```
  101. ## Build
  102. ```bash
  103. $ git clone git@github.com:dutchcoders/transfer.sh.git
  104. $ cd transfer.sh
  105. $ go build -o transfersh main.go
  106. ```
  107. ## Docker
  108. For easy deployment, we've created a Docker container.
  109. ```bash
  110. docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/
  111. ```
  112. ## S3 Usage
  113. For the usage with a AWS S3 Bucket, you just need to specify the following options:
  114. - provider
  115. - aws-access-key
  116. - aws-secret-key
  117. - bucket
  118. - s3-region
  119. If you specify the s3-region, you don't need to set the endpoint URL since the correct endpoint will used automatically.
  120. ### Custom S3 providers
  121. To use a custom non-AWS S3 provider, you need to specify the endpoint as defined from your cloud provider.
  122. ## Storj Network Provider
  123. To use the Storj Network as storage provider you need to specify the following flags:
  124. - provider `--provider storj`
  125. - storj-access _(either via flag or environment variable STORJ_ACCESS)_
  126. - storj-bucket _(either via flag or environment variable STORJ_BUCKET)_
  127. ### Creating Bucket and Scope
  128. In preparation you need to create a scope (or copy it from the uplink configuration) and a bucket.
  129. To get started, download the latest uplink from the release page: https://github.com/storj/storj/releases
  130. After extracting, execute `uplink setup`. The Wizard asks for Satellite to use, the API Key
  131. (which you can retrieve via the Satellite UI), as well as an Encryption Key.
  132. Once the uplink is setup create the bucket using the following schema:
  133. `uplink mb sj://<BUCKET>` where <BUCKET> is your desired name.
  134. Afterwards you can copy the SCOPE out of the configuration file of the uplink and then start the startup of the
  135. transfer.sh endpoint. For enhanced security its recommended to provide both the scope and the bucket name as ENV Variables.
  136. Example:
  137. ```
  138. export STORJ_BUCKET=transfersh
  139. export STORJ_ACCESS=<SCOPE>
  140. transfer.sh --provider storj
  141. ```
  142. ## Google Drive Usage
  143. For the usage with Google drive, you need to specify the following options:
  144. - provider
  145. - gdrive-client-json-filepath
  146. - gdrive-local-config-path
  147. - basedir
  148. ### Creating Gdrive Client Json
  149. You need to create a Oauth Client id from console.cloud.google.com
  150. download the file and place into a safe directory
  151. ### Usage example
  152. ```go run main.go --provider gdrive --basedir /tmp/ --gdrive-client-json-filepath /[credential_dir] --gdrive-local-config-path [directory_to_save_config] ```
  153. ## Contributions
  154. Contributions are welcome.
  155. ## Creators
  156. **Remco Verhoef**
  157. - <https://twitter.com/remco_verhoef>
  158. - <https://twitter.com/dutchcoders>
  159. **Uvis Grinfelds**
  160. ## Maintainer
  161. **Andrea Spacca**
  162. ## Copyright and license
  163. Code and documentation copyright 2011-2018 Remco Verhoef.
  164. Code released under [the MIT license](LICENSE).