Clarify README and add dir type to it

This commit is contained in:
Elara 2020-12-05 16:58:19 -08:00
parent 025125123b
commit 59b2b69bc7

View File

@ -8,11 +8,17 @@
#### Sender #### Sender
- Use `opensend -s -t <type> -d <data>` - Use `opensend -s -t <type> -d <data>`
- `type` can either be `url` or `file` - `type` can be
- If `type` is `url`, `data` should be a URL - `url`
- If `type` is `file`, `data` should be a file path - `file`
- `dir`
- `data` can be
- A website URL
- A file path
- A directory path
- Example: `opensend -s -t url -d "https://google.com"` - Example: `opensend -s -t url -d "https://google.com"`
- Example: `opensend -s -t file -d ~/file.txt` - Example: `opensend -s -t file -d ~/file.txt`
- Example: `opensend -s -t dir -d /home/user`
### Building ### Building
- This project uses go modules, so building is easy - This project uses go modules, so building is easy
@ -40,9 +46,4 @@ Opensend can run on iOS using the [iSH app](https://apps.apple.com/us/app/ish-sh
### Ports to whitelist ### Ports to whitelist
- TCP 9797 for key exchange - TCP 9797 for key exchange
- TCP 9898 for file transfer - TCP 9898 for file transfer
### How does it work?
OpenSend uses a combination of 2048-bit RSA and AES GCM encryption. This is accomplished using golang's crypto/rsa and crypto/aes libraries. First, a shared AES key is generated. Then, an RSA keypair is generated. The RSA public key is then exchanged using TCP and golang's encoding/gob library. The AES key is encrypted using the RSA public key
of the receiver. This key is then saved to a file. Next, the shared AES key is used to encrypt all the files in `~/.opensend`. To send the encrypted AES key, the sender first needs to discover the receiver. This is accomplished using zeroconf. After that, the sender starts an HTTP server with some custom functions to send the file index and key.
The receiver gets the index, files, and encrypted key from this server. Once it gets all the files, it sends a stop signal to the server and decrypts the shared key using its RSA private key. The resulting AES key is then used to decrypt all files in `~/.opensend`.