pub struct TftpServerBuilder<H: Handler> { /* private fields */ }
Expand description
TFTP server builder.
Implementations§
Source§impl TftpServerBuilder<DirHandler>
impl TftpServerBuilder<DirHandler>
Sourcepub fn with_dir_ro<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
pub fn with_dir_ro<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
Create new buidler with DirHandler
that serves only read requests.
Sourcepub fn with_dir_wo<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
pub fn with_dir_wo<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
Create new buidler with DirHandler
that serves only write requests.
Sourcepub fn with_dir_rw<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
pub fn with_dir_rw<P>(dir: P) -> Result<TftpServerBuilder<DirHandler>>
Create new buidler with DirHandler
that serves read and write requests.
Source§impl<H: Handler> TftpServerBuilder<H>
impl<H: Handler> TftpServerBuilder<H>
Sourcepub fn with_handler(handler: H) -> Self
pub fn with_handler(handler: H) -> Self
Create new builder with custom Handler
.
Sourcepub fn bind(self, addr: SocketAddr) -> Self
pub fn bind(self, addr: SocketAddr) -> Self
Set listening address.
This is ignored if underling socket is set.
Default: 0.0.0.0:69
Sourcepub fn std_socket(self, socket: UdpSocket) -> Result<Self>
pub fn std_socket(self, socket: UdpSocket) -> Result<Self>
Set underling UDP socket.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set retry timeout.
Client can override this (RFC2349). If you want to enforce it you must
combine it ignore_client_timeout
.
This crate allows you to set non-standard timeouts (i.e. timeouts that are less than a second). However if you choose to do it make sure you test it well in your environment since client’s behavior is undefined.
Default: 3 seconds
Sourcepub fn block_size_limit(self, size: u16) -> Self
pub fn block_size_limit(self, size: u16) -> Self
Set maximum block size.
Client can request a specific block size (RFC2348). Use this option if you want to set a limit.
Real life scenario: U-Boot does not support IP fragmentation and requests block size of 1468. This works fine if your MTU is 1500 bytes, however if you are accessing client through a VPN, then transfer will never start. Use this option to workaround the problem.
Sourcepub fn max_send_retries(self, retries: u32) -> Self
pub fn max_send_retries(self, retries: u32) -> Self
Set maximum send retries for a data block.
On timeout server will try to send the data block again. When retries are reached for the specific data block the server closes the connection with the client.
Default: 100 retries.
Sourcepub fn ignore_client_timeout(self) -> Self
pub fn ignore_client_timeout(self) -> Self
Ignore client’s timeout
option.
With this you enforce server’s timeout by ignoring client’s
timeout
option of RFC2349.
Sourcepub fn ignore_client_block_size(self) -> Self
pub fn ignore_client_block_size(self) -> Self
Ignore client’s block size option.
With this you can ignore client’s blksize
option of RFC2348.
This will enforce 512 block size that is defined in RFC1350.
Sourcepub async fn build(self) -> Result<TftpServer<H>>
pub async fn build(self) -> Result<TftpServer<H>>
Build TftpServer
.