An open API service indexing awesome lists of open source software.

https://github.com/trinnguyen/sendfile-cli

Send files securely via TCP/TLS 1.3 in the local network (written in Rust)
https://github.com/trinnguyen/sendfile-cli

file-sharing rust rustls tcp-protocol tls13

Last synced: 8 months ago
JSON representation

Send files securely via TCP/TLS 1.3 in the local network (written in Rust)

Awesome Lists containing this project

README

          

# sendfile-cli

## Overview
- Send files securely via TCP/TLS 1.3 in local network (no Internet needed)
- Automatically generate TLS private/public keys pair for each connection

## Process
- Each receiver runs a TCP server to listen for connections from sender
- Initiate state machines for server and client, communicate using a custom protocol
- Custom protocol for TCP packets:

```
:= ?
:= Send | Accept | Reject | StartFile | EndFile | FileData | Finish
:= NUMBER
:= FileInfo[] | Byte[]
```

- Length
- : 1 byte (number range from 0..2^8)
- : 2 bytes (number range from 0..2^16)
- : byte array (maximum 61 bytes)

## State machines (mermaid)

### Receiver (or server)

```mermaid
stateDiagram-v2
[*] --> Init
Init --> InternalAnswer: Send?
InternalAnswer --> Finish: Reject!
InternalAnswer --> WaitForFile: Accept!
WaitForFile --> StartReceivingFile: StartFile?
StartReceivingFile --> ReceiveFileData: FileData?
ReceiveFileData --> ReceiveFileData: FileData?
ReceiveFileData --> EndReceivingFile: EndFile?
EndReceivingFile --> StartReceivingFile: StartFile?
EndReceivingFile --> Finish: Finish?
```

### Sender (or client)
```mermaid
stateDiagram-v2
[*] --> Init
Init --> WaitForResponse: Send!
WaitForResponse --> Finish: Reject?
WaitForResponse --> Accepted: Accept?
Accepted --> StartSendingFile: StartFile!
StartSendingFile --> SendFileData: FileData!
SendFileData --> SendFileData: FileData!
SendFileData --> EndSendingFile: EndFile!
EndSendingFile --> StartSendingFile: StartFile!
EndSendingFile --> Finish: Finish!
```

## Run examples
- Run server
```
RUST_LOG=debug cargo run -- -s 7878
```

- Run client
```
RUST_LOG=debug cargo run -- -c 127.0.0.1:7878 -f test-data/file1.txt -f test-data/file2.txt
```