How gigachad80/gwencat-lan works
Project Type and Purpose
• This is a single‐binary, Go‐based CLI utility for high‐performance file transfers over TCP in LANs.
• It auto‐detects send/receive modes, streams files with progress updates, verifies integrity with SHA256, and handles network timeouts and IP filtering.
File Structure
• Top‐level files only:
• go.mod – Go module definition
• gwencat-lan.go – entire application source
• README.md, LICENSE
• No separate frontend/backend or microservices—this is a monolithic CLI tool.
README for Insights
• Describes core features: auto‐mode detection, cross‐platform, progress, verification, resilience, IP filtering.
• Uses only Go’s standard library (zero external dependencies).
a. Main Components
• CLI Parser
• Mode Detector
• Sender Module
• Receiver Module
• File I/O Subsystem
• Network I/O Subsystem
• SHA256 Integrity Verifier
• Progress Monitor
• Timeout & Error Handler
• IP Filter
• Underlying LAN / TCP Network
b. Relationships & Data Flows
1. User invokes gwencat-lan with flags → CLI Parser reads arguments.
2. Mode Detector checks local file existence or -mode override → branches to Sender or Receiver.
3. Sender Module:
• Opens local file (File I/O).
• Streams chunks over TCP (Network I/O) → Progress Monitor updates stats.
• Feeds data to SHA256 Verifier as it streams.
• Handles send‐side timeouts and errors.
4. Receiver Module:
• Listens on specified port (Network I/O) → accepts connection (subject to IP Filter).
• Writes incoming chunks to file (File I/O).
• Feeds data to SHA256 Verifier.
• Monitors progress and handles timeouts.
5. Upon completion, Verifier compares local checksum vs remote (embedded or negotiated) → success/failure output.
c. Architectural Patterns & Principles
• Monolithic but modularized internally into distinct packages/modules (in one file).
• Pipeline pattern for streaming + verification + monitoring.
• Fail‐fast and graceful error handling with timeouts.
• Single‐threaded or goroutine‐based streaming loops.
d. Key Technologies / Libraries
• Go standard library: flag, os, net, io, bufio, crypto/sha256, time.
• No external dependencies ensures a single portable binary.