Giter Club home page Giter Club logo

async-tftp-rs's People

Contributors

eijebong avatar oblique avatar skozlov404 avatar spod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

async-tftp-rs's Issues

No way to gracefully ends TftpServer::serve() loop

Would it be possible to add a way to gracefully stop loop in serve() function?

I should be able to prepare a pull-request adding .until(signal: async_channel::Receiver<()>) like this:

use async_tftp::server::TftpServerBuilder;
use async_tftp::Result;
use async_channel::bounded;

fn main() -> Result<()> {
    let (do_shutdown, shutdown_signal) = bounded::<()>(1);
    /*
     * do_shutdown.try_send(()).unwrap(); // for graceful shutdown
     */

    smol::run(async {
        let tftpd = TftpServerBuilder::with_dir_ro(".")?
            .until(shutdown_signal)
            .build()
            .await?;
        tftpd.serve().await?;
        Ok(())
    })
}

Provide binary

For convenient use, providing an executable binary (available via cargo install async-tftp-rs for instance) from this crate would be great. This would make it immediately useful for most use cases that just want to serve tftp, and are not looking to embed tftp in a larger application.

I think this crate would work great as an application since it implements most of the TFTP-related RFCs.

BIkeshedding topics:

  • the binary name: could probably be tftp-server, or serve-tftp, to reserve space for a future tftp-client

I'm willing to add the binary wrapper implementation and make a PR if you're willing to merge it.

Implement TftpServerBuilder

Builder can be use to define some extra options for tftp server.

Possible options:

  • set_max_blocksize - This will set a limit to the blocksize
  • disable_blocksize - This will ignore blksize option
  • set_mtu_blocksize - (Optional) Read MTU value from the network interface and calculate the maximum blocksize value.

By default blocksize is 512 bytes, but client can request bigger. However we should never accept anything bigger than can be handled based on MTU.

A real life example is using U-Boot to retrieve a file from a tftp server that is behind a VPN. U-Boot by default will request blocksize of 1468 which only works for MTU of 1500.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.