How lemunozm/termchat works
Termchat is a serverless LAN chat application with a terminal UI. Its main workflow loads user settings, discovers peers over multicast, establishes TCP connections, and exchanges chat messages; commands add file transfer and video streaming. The sampled application code supports the core networking, state, and command relationships. Several listed modules were not sampled, so their internal wiring is omitted where it cannot be established.
Main entry points: application.rs Application loop · action.rs Action processing · main.rs CLI entry · send_file.rs File transfer
Components 19
Startup and settings
- CLI entry
src/main.rs - Configuration
src/config.rs
Chat runtime
- Application loop
src/application.rs - Terminal events
src/terminal_events.rs - Chat state
src/state.rs - Wire messages
src/message.rs - Message encoding
src/encoder.rs
Commands and media
- Command manager
src/commands.rs - Action processing
src/action.rs - File transfer
src/commands/send_file.rs - Video streaming
src/commands/send_stream
Terminal presentation
- Terminal renderer
src/renderer.rs - Chat and video UI
src/ui.rs
Other components
- User
- LAN peers
- UDP and TCP
- Local files
- Video camera
- Terminal
Connections 26
- User → CLI entry: starts app
- CLI entry → Configuration: loads settings
- CLI entry → Application loop: starts runtime
- Application loop → Terminal events: collects input
- Terminal events → Terminal: reads events
- Terminal → User: shows interface
- Application loop → Terminal renderer: renders state
- Terminal renderer → Chat and video UI: draws panels
- Chat and video UI → Chat state: reads view data
- Application loop → Chat state: updates chat
- Application loop → Message encoding: encodes and decodes
- Message encoding → Wire messages: serializes
- Application loop → UDP and TCP: discovers and connects
- Application loop → LAN peers: exchanges chat
- UDP and TCP → LAN peers: carries traffic
- Application loop → Command manager: dispatches input
- Command manager → Action processing: creates actions
- Application loop → Action processing: processes actions
- Action processing → File transfer: runs transfer
- File transfer → Local files: reads file
- File transfer → UDP and TCP: sends chunks
- Application loop → Local files: writes received files
- Action processing → Video streaming: runs stream action
- Video streaming → Video camera: captures frames
- Video streaming → UDP and TCP: sends video
- Application loop → Chat state: stores received video