Commit Graph

5 Commits

Author SHA1 Message Date
27d891111f fix(client): don't create local file if remote file doesn't exist
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>
2025-12-21 13:41:49 +01:00
35cc9ee036 feat(client): add --port option to specify server port
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>
2025-12-21 13:36:05 +01:00
2388401e13 clippy: fix lints in tests 2025-12-21 13:31:51 +01:00
f4aa70ca62 feat: implement TFTP client and server binaries
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>
2025-12-21 13:19:21 +01:00
fd8dace0dc feat: implement TFTP protocol crate (pfs-tftp-proto)
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>
2025-12-21 13:10:42 +01:00