# libinpr/drop---rust architecture

> Architecture diagram of the GitHub repository libinpr/drop---rust, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/libinpr/drop---rust
- Repository: https://github.com/libinpr/drop---rust

## Overview

Drop is a LAN file-transfer application with device discovery, trusted-device pairing, encrypted transfer, and receiver-side checksum verification and file saving. The main workflow is sender discovery → secure connection → transfer header and file data → receiver validation and acknowledgement. Pairing establishes trust separately, while shared modules provide framing, cryptography, and trusted-device persistence. Some executable wiring is unsampled, so the graph omits links that cannot be tied to shown code or explicit documentation.

Main entry points: [`src/bin/send.rs`](https://github.com/libinpr/drop---rust/blob/main/src/bin/send.rs) (Send CLI), [`src/bin/server.rs`](https://github.com/libinpr/drop---rust/blob/main/src/bin/server.rs) (Receive server), [`src/secure_channel.rs`](https://github.com/libinpr/drop---rust/blob/main/src/secure_channel.rs) (Secure channel), [`src/trusted.rs`](https://github.com/libinpr/drop---rust/blob/main/src/trusted.rs) (Trusted devices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sending["Sending"]
  node_send["Send CLI<br/>[send.rs]"]
  node_discovery["LAN discovery<br/>[discovery.rs]"]
  node_discover_cli["Discovery CLI<br/>[discover.rs]"]
  node_legacy_client["Basic client<br/>[client.rs]"]
end

subgraph group_receiving["Receiving"]
  node_server["Receive server<br/>[server.rs]"]
  node_received[("Received files<br/>[server.rs]")]
end

subgraph group_trust["Pairing and Trust"]
  node_pair_cli["Pair CLI<br/>[pair.rs]"]
  node_pairing["Pairing exchange<br/>[pairing.rs]"]
  node_trusted[("Trusted devices<br/>[trusted.rs]")]
end

subgraph group_shared["Shared Protocol and Security"]
  node_header["Transfer framing<br/>[protocol.rs]"]
  node_channel["Secure channel<br/>[secure_channel.rs]"]
  node_transfer_auth["Transfer authentication<br/>[transfer_auth.rs]"]
end

node_user(("File sender"))

node_user -->|"selects file"| node_send
node_send -->|"establishes channel"| node_channel
node_send -->|"encodes header"| node_header
node_send -.->|"sends transfer"| node_server
node_server -->|"accepts connection"| node_channel
node_server -->|"decodes header"| node_header
node_server -->|"saves verified file"| node_received
node_pairing -->|"adds trusted device"| node_trusted
node_channel -->|"checks device trust"| node_trusted
node_transfer_auth -->|"checks device trust"| node_trusted
node_legacy_client -->|"sends header"| node_header
node_discover_cli -.->|"uses discovery"| node_discovery
node_send -.->|"discovers receiver"| node_discovery
node_pair_cli -.->|"starts pairing"| node_pairing

click node_send "https://github.com/libinpr/drop---rust/blob/main/src/bin/send.rs"
click node_discovery "https://github.com/libinpr/drop---rust/blob/main/src/discovery.rs"
click node_server "https://github.com/libinpr/drop---rust/blob/main/src/bin/server.rs"
click node_received "https://github.com/libinpr/drop---rust/blob/main/src/bin/server.rs"
click node_pair_cli "https://github.com/libinpr/drop---rust/blob/main/src/bin/pair.rs"
click node_pairing "https://github.com/libinpr/drop---rust/blob/main/src/pairing.rs"
click node_trusted "https://github.com/libinpr/drop---rust/blob/main/src/trusted.rs"
click node_header "https://github.com/libinpr/drop---rust/blob/main/src/protocol.rs"
click node_channel "https://github.com/libinpr/drop---rust/blob/main/src/secure_channel.rs"
click node_transfer_auth "https://github.com/libinpr/drop---rust/blob/main/src/transfer_auth.rs"
click node_discover_cli "https://github.com/libinpr/drop---rust/blob/main/src/bin/discover.rs"
click node_legacy_client "https://github.com/libinpr/drop---rust/blob/main/src/bin/client.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_send,node_discovery,node_discover_cli,node_legacy_client toneBlue
class node_server,node_received toneAmber
class node_pair_cli,node_pairing,node_trusted toneMint
class node_header,node_channel,node_transfer_auth toneRose
class node_user toneIndigo
```

## Components

### Sending

- [Send CLI](https://github.com/libinpr/drop---rust/blob/main/src/bin/send.rs): `src/bin/send.rs`
- [LAN discovery](https://github.com/libinpr/drop---rust/blob/main/src/discovery.rs): `src/discovery.rs`
- [Discovery CLI](https://github.com/libinpr/drop---rust/blob/main/src/bin/discover.rs): `src/bin/discover.rs`
- [Basic client](https://github.com/libinpr/drop---rust/blob/main/src/bin/client.rs): `src/bin/client.rs`

### Receiving

- [Receive server](https://github.com/libinpr/drop---rust/blob/main/src/bin/server.rs): `src/bin/server.rs`
- [Received files](https://github.com/libinpr/drop---rust/blob/main/src/bin/server.rs): `src/bin/server.rs`

### Pairing and Trust

- [Pair CLI](https://github.com/libinpr/drop---rust/blob/main/src/bin/pair.rs): `src/bin/pair.rs`
- [Pairing exchange](https://github.com/libinpr/drop---rust/blob/main/src/pairing.rs): `src/pairing.rs`
- [Trusted devices](https://github.com/libinpr/drop---rust/blob/main/src/trusted.rs): `src/trusted.rs`

### Shared Protocol and Security

- [Transfer framing](https://github.com/libinpr/drop---rust/blob/main/src/protocol.rs): `src/protocol.rs`
- [Secure channel](https://github.com/libinpr/drop---rust/blob/main/src/secure_channel.rs): `src/secure_channel.rs`
- [Transfer authentication](https://github.com/libinpr/drop---rust/blob/main/src/transfer_auth.rs): `src/transfer_auth.rs`

### Other components

- **File sender**

## Connections

- File sender → Send CLI: selects file (evidence: `src/bin/send.rs`)
- Send CLI → Secure channel: establishes channel (evidence: `src/bin/send.rs`)
- Send CLI → Transfer framing: encodes header (evidence: `src/bin/send.rs`)
- Send CLI → Receive server: sends transfer
- Receive server → Secure channel: accepts connection (evidence: `src/bin/server.rs`)
- Receive server → Transfer framing: decodes header (evidence: `src/bin/server.rs`)
- Receive server → Received files: saves verified file (evidence: `src/bin/server.rs`)
- Pairing exchange → Trusted devices: adds trusted device (evidence: `src/pairing.rs`)
- Secure channel → Trusted devices: checks device trust (evidence: `src/secure_channel.rs`)
- Transfer authentication → Trusted devices: checks device trust (evidence: `src/transfer_auth.rs`)
- Basic client → Transfer framing: sends header (evidence: `src/bin/client.rs`)
- Discovery CLI → LAN discovery: uses discovery
- Send CLI → LAN discovery: discovers receiver
- Pair CLI → Pairing exchange: starts pairing
