Instead of downloading the entire file to memory before writing to disk,
stream directly to a DeferredFileWriter that only creates the local file
after receiving the first DATA packet. This provides the same guarantee
(no local file created if remote doesn't exist) while being more memory
efficient for large files.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, the get command would create/truncate the local file before
starting the download, then delete it on error. This could inadvertently
destroy an existing local file if the remote file didn't exist.
Now the download completes to memory first, and the local file is only
written after a successful transfer. This is safe for TFTP since files
are typically small (bootloaders, configs, etc.).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Allow users to override the default TFTP port (69) when connecting
to servers running on non-standard ports. The port can be specified
via -p or --port flag.
Examples:
tftp -p 6969 get 192.168.1.1 config.txt
tftp --port 1069 put myserver firmware.bin
If a port is embedded in the host (host:port format), the --port
option takes precedence.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add command-line programs for TFTP operations:
tftpd - TFTP server daemon:
- Configurable root directory for serving files
- Optional write support with --writable flag
- Optional file overwriting with --overwrite flag
- Custom port binding (default: 69)
- Path traversal protection for security
tftp - TFTP client:
- get command for downloading files
- put command for uploading files
- Support for both octet and netascii modes
- Verbose mode for debugging
Also adds comprehensive integration tests that verify client-server
communication with real network I/O.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit introduces a sans-IO TFTP protocol implementation following
RFC 1350. The protocol crate provides:
- Packet types: RRQ, WRQ, DATA, ACK, ERROR with full serialization/parsing
- Error codes as defined in RFC 1350 Appendix
- Transfer modes: octet (binary) and netascii
- Client and server state machines for managing protocol flow
- Comprehensive tests for all packet types and state transitions
The sans-IO design separates protocol logic from I/O operations, making
the code testable and reusable across different I/O implementations.
Key design decisions:
- Mail mode is explicitly rejected as obsolete per RFC 1350
- Block numbers wrap around at 65535 for large file support
- State machines emit events that tell the I/O layer what to do next
- All protocol-specific values are documented with RFC citations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>