a simple TFTP server written in rust with read and write callbacks
Project description
simpleTFTPS
simpleTFTPS is a high-performance TFTP (Trivial File Transfer Protocol) server written in Rust, providing seamless integration for C++ and Python through native bindings. It allows developers to implement custom GET and PUT logic via simple callbacks.
- Sources: all sources are available at https://gl2.aws.paperboat.cz/lazox12/pytftps, or at a mirror at https://github.com/Lazox12/simpleTFTPS
Features
- Core in Rust: Fast, safe, and concurrent TFTP engine.
- Unified Build: Simple
Makefileto build everything (Rust, C++, Python). - Easy Integration: Native bindings for C++ and Python.
- Customizable: Simple callback system to handle file requests and uploads.
- Multi-threaded: Handles multiple client requests simultaneously using Rust threads.
- Modern Python Support: Compatible with Python 3.7+ (GIL-safe).
Prerequisites
- Rust: Installation guide
- C++ Compiler: GCC (G++) or Clang supporting C++17
- Python: Python 3.7 or higher (for Python bindings)
- Make: To use the simplified build system
- libcurl: Required for integration tests
Quick Start
Build Everything
To build the Rust library, C++ examples, and Python extension:
make
Run All Tests
To run Rust unit tests, C++ integration tests, and Python integration tests:
make test
Clean Up
To remove all build artifacts:
make clean
Usage
C++
Include the header and link against the Rust static library. Use the run() function with your callbacks.
#include "simpletftps.hpp"
extern "C" char* my_get_callback(const char* file) {
return strdup("Data content");
}
int main() {
run(my_get_callback, nullptr, "127.0.0.1:6969");
return 0;
}
Python
Import the module and run the server in a thread (as run is blocking).
import simpleTFTPS
import threading
def cb_get(file):
return "File content"
def cb_put(file):
return False
threading.Thread(target=simpleTFTPS.run, args=("127.0.0.1:9001", cb_get, cb_put), daemon=True).start()
Project Structure
simpleTFTPS/: Rust implementation of the TFTP engine.include/: C++ header and Python binding implementation.tests/: Integration tests for C++, Python, and Rust.Makefile: Unified build system.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simpletftps-1.0.1.tar.gz.
File metadata
- Download URL: simpletftps-1.0.1.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96aa27287e1e064988bbff0393d15769a4cd4830aa7ba5c247a856d602d58c67
|
|
| MD5 |
708f1b010ce542f167670896df38c864
|
|
| BLAKE2b-256 |
ea714bab9fcafde85a44ad814375af9029b39ae42b04137b9f724d1a9c038687
|
File details
Details for the file simpletftps-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: simpletftps-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d17492922ec801f1dc577c2aea1e69105b0bf187cd6de6c20aabe09d1bcd61
|
|
| MD5 |
e3f30b4e2b02f42e3a75a058c4b8ecf6
|
|
| BLAKE2b-256 |
25ab7b1d67d0d3f224d06d16307b44cf114b17c1bd6e711e44f729ba3480d913
|