Skip to main content

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.

Features

  • Core in Rust: Fast, safe, and concurrent TFTP engine.
  • Unified Build: Simple Makefile to 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"

threading.Thread(target=simpleTFTPS.run, args=("127.0.0.1:9001", cb_get, None), 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpletftps-1.0.0.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simpletftps-1.0.0-cp313-cp313-manylinux_2_39_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

File details

Details for the file simpletftps-1.0.0.tar.gz.

File metadata

  • Download URL: simpletftps-1.0.0.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

Hashes for simpletftps-1.0.0.tar.gz
Algorithm Hash digest
SHA256 438bbe97c1a777b89b189c405f6505e44af16993dba0d22b830eab4725ed21fb
MD5 07be66dc63c44c539c5f75846d12abac
BLAKE2b-256 c677493266181f03d5f4449812d81390f5beb594f3e8f1b7f2da84154a6a52f5

See more details on using hashes here.

File details

Details for the file simpletftps-1.0.0-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for simpletftps-1.0.0-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 11cf4852e14ecd84dbcad257e4643dc9ac7912f0e2859c65b167563386921c95
MD5 4804e54f054b353f418465c2422dcd60
BLAKE2b-256 2b62170b446018d356734c9b0f206c09bab0003dc86fdf3ad499112cf7c00021

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page