Skip to main content

Module client

Module client 

Source
Expand description

TFTP client implementation

This module provides TFTP client functionality:

  • File download (GET/RRQ)
  • File upload (PUT/WRQ)
  • Supports all TFTP option extensions

§Usage Examples

§Download file

use xtool::tftp::client::Client;
use xtool::tftp::client::config::ClientConfig;
use std::path::Path;

let config = ClientConfig::new("192.168.1.100".to_string(), 69);
let client = Client::new(config).unwrap();
client.get("remote.txt", Path::new("local.txt")).unwrap();

§Upload file

use xtool::tftp::client::Client;
use xtool::tftp::client::config::ClientConfig;
use std::path::Path;

let config = ClientConfig::new("192.168.1.100".to_string(), 69);
let client = Client::new(config).unwrap();
client.put(Path::new("local.txt"), "remote.txt").unwrap();

§Command Line Usage

# Download file
xtool tftpc get 192.168.1.100 remote.txt [local.txt]

# Upload file
xtool tftpc put 192.168.1.100 local.txt [remote.txt]

Modules§

config

Structs§

Client
TFTP client

Enums§

TftpcAction

Functions§

run_with_config
Run TFTP client command with configuration