You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DESIGN.md
+100-2Lines changed: 100 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1907,16 +1907,114 @@ test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured
1907
1907
1908
1908
---
1909
1909
1910
+
## GUI Architecture
1911
+
1912
+
### Implementation Overview (October 2025)
1913
+
1914
+
The GUI is implemented using the **Iced framework** for cross-platform support with a reactive, Elm-inspired architecture. The design separates UI state from transfer operations while maintaining async compatibility.
A lightning-fast, resilient peer-to-peer file transfer system built in Rust with advanced features like resume support, real-time progress tracking, and windowed transfer protocol for optimal performance.
3
+
A lightning-fast, resilient peer-to-peer file transfer system built in Rust with advanced features like resume support, real-time progress tracking, GUI interface, and windowed transfer protocol for optimal performance.
10
4
11
5
## Overview
12
6
13
-
P2P File Transfer is a production-ready command-line tool for transferring files and folders between devices on a local network. It features automatic peer discovery, fault-tolerant transfers with resume capability, and optimized performance through parallel chunk transfers.
7
+
P2P File Transfer is a production-ready application for transferring files and folders between devices on a local network. It features both a graphical user interface (default) and command-line interface, automatic peer discovery, fault-tolerant transfers with chunk-level resume capability, and optimized performance through parallel chunk transfers.
14
8
15
9
**Key Highlights:**
10
+
- 🖥️ **GUI Interface**: Modern graphical interface with tabbed navigation (default mode)
16
11
- ⚡ **Windowed Transfer Protocol**: Parallel chunk transfers for 5-15x speedup on high-latency networks
17
-
- 💾 **Automatic Resume**: Seamlessly continue interrupted transfers with state persistence
- ✅ **GUI-Ready**: Foundation for interactive applications with persistent connections
64
+
- ✅ **GUI Implementation**: Full-featured Iced-based interface with async/await support
64
65
65
66
### Networking
66
67
- ✅ **TCP with Keepalive**: Reliable connections with automatic ping/pong
@@ -87,7 +88,31 @@ cargo build --release
87
88
./target/release/p2p-transfer
88
89
```
89
90
90
-
### Basic Usage
91
+
### GUI Mode (Default)
92
+
93
+
Simply run the program to launch the graphical interface:
94
+
95
+
```bash
96
+
# Default: Launch GUI
97
+
p2p-transfer
98
+
99
+
# Or explicitly specify GUI mode
100
+
p2p-transfer gui
101
+
```
102
+
103
+
**GUI Features:**
104
+
-**Connection Tab**: Start listening or connect to peers with discovery support
105
+
-**Send Tab**: Browse and select files/folders to transfer
106
+
-**Receive Tab**: Set download folder and auto-accept preferences
107
+
-**Settings Tab**: Configure all transfer parameters (compression, window size, bandwidth, etc.)
108
+
-**History Tab**: View past transfers with statistics
109
+
-**Real-time Progress**: Visual progress bar with speed, ETA, and transfer statistics
110
+
111
+
### CLI Mode
112
+
113
+
For command-line usage and automation, use specific commands:
114
+
115
+
#### Basic Usage
91
116
92
117
#### Bidirectional Sessions
93
118
After a session is established, **both peers are equal** and can send or receive files. The `--role` parameter only determines who initiates the connection:
@@ -383,23 +408,48 @@ p2p-transfer/
383
408
│ ├── error.rs # Error types
384
409
│ ├── protocol.rs # Protocol messages
385
410
│ ├── config.rs # Configuration
386
-
│ ├── state.rs # Transfer state
387
-
│ ├── compression.rs # Zstd compression
388
-
│ ├── verification.rs # CRC32/SHA256
411
+
│ ├── state.rs # Transfer state persistence
412
+
│ ├── history.rs # Transfer history tracking
413
+
│ ├── compression.rs # Adaptive Zstd compression
414
+
│ ├── verification.rs # Streaming CRC32/SHA256
389
415
│ ├── window.rs # Sliding window protocol
416
+
│ ├── bandwidth.rs # Token bucket rate limiting
417
+
│ ├── reconnect.rs # Auto-reconnect with backoff
390
418
│ ├── network/ # Networking layer
391
-
│ │ ├── framing.rs # Message framing
419
+
│ │ ├── framing.rs # MessagePack framing
392
420
│ │ ├── tcp.rs # TCP connections
393
421
│ │ └── udp.rs # UDP discovery
394
422
│ ├── discovery.rs # Peer discovery
423
+
│ ├── nat.rs # STUN NAT traversal
395
424
│ ├── handshake.rs # Connection handshake
396
-
│ ├── transfer.rs # Transfer coordination
425
+
│ ├── session.rs # P2P session management
397
426
│ ├── transfer_file.rs # File transfer logic
398
427
│ └── transfer_folder.rs # Folder transfer logic
399
428
├── p2p-cli/ # CLI interface
400
-
│ └── src/lib.rs # Clap-based CLI
401
-
├── p2p-gui/ # GUI (future)
402
-
│ └── src/lib.rs # Iced-based GUI (planned)
429
+
│ └── src/
430
+
│ ├── lib.rs # CLI entry point
431
+
│ ├── cli.rs # Clap-based argument parsing
432
+
│ ├── send.rs # Send command
433
+
│ ├── receive.rs # Receive command
434
+
│ ├── discover.rs # Discovery command
435
+
│ ├── nat_test.rs # NAT test command
436
+
│ ├── resume.rs # Resume command
437
+
│ └── history.rs # History command
438
+
├── p2p-gui/ # GUI interface
439
+
│ └── src/
440
+
│ ├── lib.rs # GUI entry point
441
+
│ ├── app.rs # Iced application
442
+
│ ├── state.rs # GUI state
443
+
│ ├── message.rs # Event messages
444
+
│ ├── operations.rs # Async operations
445
+
│ ├── utils.rs # Formatting utilities
446
+
│ ├── styles.rs # Color palette
447
+
│ └── views/ # Tab views
448
+
│ ├── connection.rs
449
+
│ ├── send.rs
450
+
│ ├── receive.rs
451
+
│ ├── settings.rs
452
+
│ └── history.rs
403
453
└── tests/ # Integration tests
404
454
└── integration_test.rs
405
455
```
@@ -417,16 +467,28 @@ p2p-transfer/
417
467
|-------|---------|--------|
418
468
|**Phase 1**| Core Networking | ✅ Complete |
419
469
|| TCP/UDP, Discovery, Handshake | ✅ Complete |
470
+
|| NAT Traversal (STUN) | ✅ Complete |
420
471
|**Phase 2**| File Transfer | ✅ Complete |
421
472
|| Single files, Folders, Compression | ✅ Complete |
0 commit comments