oblique / async-tftp-rs Goto Github PK
View Code? Open in Web Editor NEWExecutor agnostic async TFTP implementation
License: MIT License
Executor agnostic async TFTP implementation
License: MIT License
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(())
})
}
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:
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.
Use atftp
to test if transfer is done correctly.
How can I run the server inside a new thread?
Builder can be use to define some extra options for tftp server.
Possible options:
blksize
optionBy 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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.