altugbakan / rs-tftpd

TFTP Server Daemon implemented in Rust
https://crates.io/crates/tftpd
MIT License
51 stars 14 forks source link

Added client to rs-tftpd #22

Closed Blenderwizard closed 2 months ago

Blenderwizard commented 2 months ago

Implements #21

Add a TFTP client, enabled with the client feature: Example: cargo build --features client

The client supports TFTP Option Extension as defined by RFC 2347

A user can set the following options:

and the client automatically sets the Transfer Size Option RFC 2349

Client CLI options:

TFTP Client

Usage: tftpd client [OPTIONS] <-f | --file> <File>

Options:
  -i, --ip-address <IP ADDRESS> Ip address of the server (default: 127.0.0.1)
  -p, --port <PORT>             Port of the server (default: 69)
  -b, --blocksize <number>      Sets the blocksize (default: 512)
  -w, --windowsize <number>     Sets the windowsize (default: 1)
  -t, --timeout <seconds>       Sets the timeout in seconds (default: 5)
  -u, --upload                  Sets the client to upload mode, Ignores all previous download flags
  -d, --download                Set the client to download mode, Invalidates all previous upload flags
  -f, --file                    Local file to upload if in upload mode. Name of the remote file if in download mode
  -sd, --save-directory <DIRECTORY>     Set the directory to save files when in Download Mode (default: the directory setting)
  -h, --help                    Print help information

Server CLI options (ONLY WHEN CLIENT FEATURE IS ENABLED):

TFTP Server Daemon

Usage: tftpd server [OPTIONS]

Options:
  -i, --ip-address <IP ADDRESS> Set the ip address of the server (default: 127.0.0.1)
  -p, --port <PORT>             Set the listening port of the server (default: 69)
  -d, --directory <DIRECTORY>   Set the serving directory (default: current working directory)
  -rd, --receive-directory <DIRECTORY>  Set the directory to receive files to (default: the directory setting)
  -sd, --send-directory <DIRECTORY>     Set the directory to send files from (default: the directory setting)
  -s, --single-port             Use a single port for both sending and receiving (default: false)
  -r, --read-only               Refuse all write requests, making the server read-only (default: false)
  --duplicate-packets <NUM>     Duplicate all packets sent from the server (default: 0)
  --overwrite                   Overwrite existing files (default: false)
  -h, --help                    Print help information
altugbakan commented 2 months ago

From an overview this looks great! I liked how you used the feature flags so there’s almost no code overhead.

I see that you’ve opened this as a draft, but it looks ready for review. Do you want me to review this?

Blenderwizard commented 2 months ago

I asked some people from my work to take a look, but If you want to review I can remove the draft.

altugbakan commented 2 months ago

Yeah no worries, I will check it when it’s ready to review.

Blenderwizard commented 2 months ago

That should be all of your requested changes.

altugbakan commented 2 months ago

LGTM!