Skip to main content

Socket-style Python bindings for the Fuse UDP transport protocol

Project description

fuse-transport

Socket-style Python bindings for Fuse, an experimental UDP transport with per-stream congestion control — so a stalled bulk transfer cannot throttle unrelated latency-sensitive traffic on the same session, which is the thing QUIC's connection-wide controller cannot do.

pip install fuse-transport
# or
uv add fuse-transport

Linux only. Wheels bundle the compiled transport and its wolfSSL, so there is no compiler, no CMake, and no system library to install.

import fuse

Server

import threading
import fuse

def handle(conn):
    with conn:
        for message in conn:        # iterates until the peer closes
            conn.send(b"ECHO:" + message)

with fuse.listen(port=4433) as server:
    for conn in server:             # iterates incoming connections
        threading.Thread(target=handle, args=(conn,), daemon=True).start()

Client

import fuse

with fuse.connect("192.0.2.10", 4433, timeout=5) as conn:
    conn.send(b"hello")             # str is UTF-8 encoded for you
    print(conn.recv(timeout=5).decode())

Two ways this differs from a TCP socket

Messages, not a byte stream. One send becomes exactly one recv. Boundaries are preserved (like SOCK_SEQPACKET), so you never length-prefix, never scan for delimiters, and a partial read cannot happen.

send means delivered. It returns once the peer has acknowledged the message, not when it was queued locally. A successful send is proof of arrival.

Retransmission, ordering, congestion control and adaptive block sizing are handled underneath.

Encryption

Set the same key on both ends for AES-256-GCM:

fuse.listen(port=4433, key="shared-secret")
fuse.connect("192.0.2.10", 4433, key="shared-secret")

A client presenting the wrong key is rejected during the handshake and never exchanges data. Note this is a pre-shared key, so there is no forward secrecy: someone who records traffic and later obtains the key can decrypt it. If that matters, run Fuse inside a tunnel that provides it.

API

call notes
fuse.listen(port, bind="0.0.0.0", key=None, timeout=None) Listener
fuse.connect(host, port, key=None, timeout=None) Connection
Listener.accept(timeout=None) Connection; iterate the listener for a loop
Listener.port actual port (pass port=0 to let the OS pick)
Connection.send(data) bytes / bytearray / memoryview / str
Connection.recv(timeout=None) bytes; iterate for a message loop
Connection.peer (address, port)
Connection.stats counters, including rtt_us
Connection.closed bool
.close() also via with blocks; idempotent

Timeouts are seconds (float): None waits indefinitely, 0 polls.

Exceptions all derive from fuse.FuseError: Timeout, ConnectionClosed, AuthError, ConfigError, MessageTooLarge.

Blocking calls release the GIL, so other threads keep running while one is parked in recv.

Checking an install

python -m fuse selftest

Prints the version, which library got loaded, and whether encryption is available, then runs a loopback round-trip — which also confirms this kernel supports the socket features Fuse needs.

Also in this project

A C/C++ SDK with the same API (#include <fuse/sdk.h>), and a separate higher-throughput API for moving whole files or large buffers. Both come from the standalone installer:

curl -fsSL https://github.com/kamalkoushikd/fuse-nw/releases/latest/download/install.sh | sh

License

MIT. Note that the bundled wolfSSL is GPLv2 (a commercial license is available from wolfSSL Inc.), so a wheel that links it is a combined work subject to the GPL when redistributed.

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

fuse_transport-0.1.0.tar.gz (175.3 kB view details)

Uploaded Source

Built Distributions

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

fuse_transport-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (685.3 kB view details)

Uploaded Python 3manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

fuse_transport-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (645.0 kB view details)

Uploaded Python 3manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file fuse_transport-0.1.0.tar.gz.

File metadata

  • Download URL: fuse_transport-0.1.0.tar.gz
  • Upload date:
  • Size: 175.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fuse_transport-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d972beefda682a900ee4f3021e434a2fd0c1cd957ec88b08ada36b3552eb58e
MD5 f9d3a94acaba73a1d745c1e56c3aa6f1
BLAKE2b-256 fe5773da43438624ec4d65e126bad151c04b7abb0b5030dd2534aa00c614a1c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuse_transport-0.1.0.tar.gz:

Publisher: publish-python.yml on kamalkoushikd/fuse-nw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fuse_transport-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fuse_transport-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cb051026dae91b7756dc795400a6ab66a21db1d9044cbacc357ca383274b8d32
MD5 b66088234cc21b09d6e71d4667ef247c
BLAKE2b-256 37ee8f98af78be621044be17231c41da03ffd82c407b255c10c5b17d26c6338e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuse_transport-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-python.yml on kamalkoushikd/fuse-nw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fuse_transport-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fuse_transport-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4f07521065e4eea4e30385fad1b75901f1e15d4ec24a242258c625b991fa4541
MD5 13c2458918bf3075f56ebd1212b12fd8
BLAKE2b-256 e86b645f3fabf84b886e547d7f01a36d84da8e420d7715a836b3386e9a0e59d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuse_transport-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish-python.yml on kamalkoushikd/fuse-nw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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