Repository navigation
v0.0.0
Added
Client: download and upload over IPv4 and IPv6, to and from paths, binary
files or memory, withblksize,windowsize,tsizeandtimeout
negotiation (and theutimeout,rollover,blksize2andcookie
extensions on request), progress andon_negotiatedcallbacks, exponential
backoff of retransmissions, an optional time limit, and a one-time retry
without options when a server refuses them (ERROR 8).blksize="mtu"sizes
blocks to the route's interface MTU; hosts may carry a port
("[::1]:6969").Server: one event-loop thread serving any number of transfers, each on its
own socket bound to the address the request was sent to (pktinfo); dual-stack
::listening by default; a negotiation policy (ServerOptions: maximum
block and window size, window memory bound, allowed and refused options,
fittingblksizeto the arrival interface's MTU); resource limits
(ServerLimits: request size, filename length, option count and length,
sessions per client, transfer duration); ignoring requests sent to broadcast
or multicast addresses; blocking handlers opened in worker threads;
dallying on the last ACK of an upload;on_completefor every transfer;
counters for metrics (stats,stats_snapshot()).FileSystemHandler: serves a directory with containment against..,
symlinks and Windows device names; backslash separators; atomic uploads;
create/overwritepolicy;max_uploadand free-space checks fromtsize.- Handler protocol (
open_read/open_write) for generated content; sources
and sinks may report "not ready yet" (WouldBlock) and wake the transfer
from another thread, so slow backends apply backpressure instead of
blocking the server. - Backends:
MemoryHandler;HttpHandler, a TFTP-to-HTTP(S) gateway (GET and
PUT, HTTP status codes mapped to TFTP errors,Content-Lengthastsize);
UpstreamHandler, a terminating proxy to another TFTP server whose two sides
negotiate independently;Pipefor writing such handlers. Relay: a transparent relay forwarding requests byte for byte to upstream
servers and datagrams unchanged between the two transfer IDs, with routing
by client subnet, filename prefix or arrival interface, idle and lifetime
limits, per-transfer summaries and counters.tftp.aio:AsyncClient(includingstream(), an async generator with
backpressure) andAsyncServer(async handlers and streams, pktinfo on every
event loop including Windows' Proactor loop).- Option negotiation through a registry of option handlers, so applications can
add their own; compatibility profilesSTRICT,DEFAULT,PXE,HPAand
LEGACY. - Capture and debugging:
trace=hooks on the client, server and relay
reporting every datagram as aPacketEvent;PcapWriter(Wireshark-readable
pcap); pcap/pcapng reading from files or live pipes with IP fragment
reassembly;FlowTracker/analyze()reconstructing transfers and their
files from a capture; a filter language; live capture on Linux. tftp://URLs (RFC 3617):parse_url,format_url,download_url,
upload_url.Client.size(): a file's size without transferring it (atsizeprobe the
server counts as declined, not failed).pathextra:TftpPath, a pathlib-nextPathbound to a client
(client.path(...)), andTftpUriPath, thetftp://scheme for
pathlib-next'sUriPath; whole-file streaming reads and writes,stat()
without a transfer,copy()/move()across schemes.- Typed errors:
RemoteErrorraised asFileNotFound,AccessViolation,
DiskFull,IllegalOperation,UnknownTransferId,FileAlreadyExists,
NoSuchUserorOptionNegotiationError;TransferAborted. - Transfer engine (
Sender/Receiver) with RFC 7440 windowing, the
Sorcerer's Apprentice fix, unknown-TID handling, tolerance of repeated
OACKs and unlimited file size via block-number rollover, usable without
sockets. - Streaming netascii in both directions; packet encode/decode for every RFC
1350 and RFC 2347 packet, keeping a request's raw bytes for forwarding. pytftpcommand (cliextra):getandput(also by URL),serve(a
directory,--httpgateway or--upstreamproxy),relay,capture;
--compatprofiles,--traceand--pcapon every command that moves
packets,--jsonoutput.port_range=onServer,AsyncServerandRelay(PortRange):
transfer sockets take their ports from a range a firewall can allow;
--port-rangeonpytftp serveandrelay.pytftp serve --per-client(serveROOT/<client address>/when it exists),
--ignore-caseand--remap REGEX=REPLACEMENT.mstfwindow, Windows bootmgr's variable-window option, as an extension a
server may allow (fixed window of 4).- pytftp's
x-listandx-mtimeextensions (LISTING_OPTIONS): directory
listings (tftp.listing) and modification times.Client.stat(),
Client.listdir()(async too),pytftp ls,pytftp serve --listing, and
iterdir/walk/glob/is_dir/st_mtimeonTftpPathandTftpUriPath. - Hosts, networks and interfaces accepted as objects (
ipaddresstypes,
netimps.Host,netimps.Interface) wherever an address is taken, typed
with netimps' aliases. interface=onServer,AsyncServerandRelay(and--interfaceon
pytftp serve/relay): listen on one network adapter, by name,
netimps.Interface, MAC or address.RequestContext.interface: the arrival interface as anetimps.Interface.- Loopback throughput benchmark (
benchmarks/run.py). - Licensed under MIT.
Full Changelog: https://github.com/jose-pr/pytftp/commits/v0.0.0