neruton (Python SDK & CLI)
Native pure-Python tunnel client & SDK for Neruton — self-hosted intranet penetration, wildcard subdomain reverse proxy, and WebSocket tunneling over port 443 (WSS + Yamux).
- 100% pure Python (no Rust binary wrapper, no C extensions) implementing the exact Neruton control protocol and Yamux v0 multiplexer byte-for-byte compatible with
neruton-server(yamux 0.13). - Default DNS-over-HTTPS (RFC 8484) + Hidden SNI: zero-dependency IP-based DoH (zero bootstrap DNS leak) paired with TLS ClientHello TCP fragmentation by default, plus custom/omitted SNI with strict RFC 6125 certificate verification.
- Async & Sync Python APIs with full PEP 561 type annotations (
py.typed). - Drop-in CLI (
nerutonandpython -m neruton) sharing~/.config/neruton/config.toml(0600) andNERUTON_*environment variables with the Rust CLI. - Full HTTP/1.1 & WebSocket forwarding with Host rewriting, chunked streaming, local HTTPS (
--no-tls-verify), automatic reconnect with sticky prefix, and fail-fast on HTTP 401 auth errors.
Installation
pip install neruton
Requires Python 3.9+.
Quick Start — Python SDK
Async API (asyncio / FastAPI / Starlette / aiohttp)
import asyncio
import neruton
async def main() -> None:
async with neruton.connect(
url="http://127.0.0.1:3000",
server="https://neruton.moer.eu.org",
token="ntk_your_token_here",
subdomain="my-app", # optional; auto-assigns UUID v4 if omitted
) as tunnel:
print("Public URL :", tunnel.public_url)
print("Preview URL:", tunnel.preview_url)
print("Path URL :", tunnel.path_url)
print("Prefix :", tunnel.prefix)
print("Transport :", tunnel.transport_info)
await tunnel.wait()
asyncio.run(main())
Shorthand helpers for local ports:
async with neruton.forward(3000, subdomain="my-app") as tunnel:
print(tunnel.public_url)
# Alias matching `neruton http 8080`:
tunnel = await neruton.http(8080)
try:
print(tunnel.public_url)
finally:
await tunnel.close()
Sync API (Flask / Django / Scripts / Notebooks)
neruton.open(...) runs the tunnel's asyncio event loop on a dedicated daemon thread and shuts down cleanly when exiting the with block:
import neruton
with neruton.open(5000, server="https://neruton.moer.eu.org", token="ntk_your_token_here") as tunnel:
print("Tunnel live at:", tunnel.public_url)
app.run(port=5000)
DNS-over-HTTPS (DoH) & Hidden SNI
By default (doh="auto", sni_mode="auto"), non-local wss:// connections resolve the gateway hostname via RFC 8484 binary DoH against IP-based endpoints (1.0.0.1, 223.5.5.5, 1.1.1.1, 8.8.4.4, racing the first two with fallback — zero bootstrap DNS leak) and split the initial TLS ClientHello across multiple TCP segments while preserving full TLS 1.3 certificate validation. Local targets (ws://, localhost, *.localhost, *.local, and IP literals) automatically skip DoH and SNI hiding.
# Strict DoH (fail instead of falling back to system DNS) + ClientHello fragmentation
async with neruton.connect(3000, doh="strict", sni_mode="fragment") as tunnel:
print(tunnel.transport_info)
# Custom DoH endpoint(s) and custom/omitted SNI (cert is still verified against real server host)
async with neruton.connect(
3000,
doh=["https://1.0.0.1/dns-query", "https://223.5.5.5/dns-query"],
sni_mode="none", # or sni="example-front.example"
) as tunnel:
...
# Disable DoH and SNI hiding
async with neruton.connect(3000, doh=False, sni_mode="plain") as tunnel:
...
Note on TLS 1.3 ECH (
sni_mode="ech"): Python's stdlibsslmodule (3.9–3.14) does not yet expose native TLS 1.3 Encrypted Client Hello (ECH). Requestingsni_mode="ech"fails fast withTunnelError; usesni_mode="auto"/"fragment"in pure Python, or use the RustnerutonCLI when cryptographic TLS 1.3 ECH is required.
Config Helpers
import neruton
print(neruton.config_path()) # ~/.config/neruton/config.toml
neruton.save_config(
server="https://neruton.moer.eu.org",
token="ntk_your_token_here",
doh="auto",
sni_mode="auto",
)
cfg = neruton.load_config()
Quick Start — CLI
# Save default server, token, and stealth transport preferences (writes mode 0600 config.toml)
neruton config set --server https://neruton.moer.eu.org --token ntk_your_token_here --doh auto --sni-mode auto
neruton config show
neruton config path
# Forward a local port with default DoH + ClientHello TCP fragmentation
neruton http 3000
# Override DoH / SNI options per invocation (CLI flags > NERUTON_* env > config.toml > defaults)
neruton http 8080 -s my-app --doh strict --sni-mode fragment
neruton tunnel --url http://127.0.0.1:3000 --no-doh --sni-mode plain
neruton http 3000 --sni-mode none
neruton http 3000 --sni moer.eu.org
# Or invoke as a Python module
python -m neruton http 3000
python -m neruton version
Environment variables: NERUTON_SERVER, NERUTON_TOKEN, NERUTON_DOH, NERUTON_SNI_MODE, NERUTON_SNI, NERUTON_ECH_CONFIG.
License
MIT
Metadata
Release files for neruton 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neruton-0.3.0.tar.gz | 81.5 kB | Without provenance | Details for neruton-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neruton-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for neruton-0.3.0-py3-none-any.whl |
Total release size: 138.8 kB
Release files / neruton-0.3.0.tar.gz
| Download URL | neruton-0.3.0.tar.gz |
|---|---|
| Size | 81.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04a117d0b1e50c44d23b100fed98cf4bff0935f3108caf83d00a1ba3d3f79647
|
|
BLAKE2b-256 checksum How to use checksums |
6c990de7a2ff93eb68575cbb07a17ecb65def5d499bdf65af3d98d6c964c7e71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / neruton-0.3.0-py3-none-any.whl
| Download URL | neruton-0.3.0-py3-none-any.whl |
|---|---|
| Size | 57.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25f783c4f5959d07518134ddb9071a958422826f361ae854c048f290587299d4
|
|
BLAKE2b-256 checksum How to use checksums |
95a9d2baf9846e6f856d59019396675a18de3fef6070e0050141948750595b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for neruton 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.