Skip to main content

etunnel for Python

PyPI

websocket-client based.

Zero registration: every SDK client speaks the same tiny wire protocol (PROTOCOL.md) against any etunnel server (default wss://t.etun.uk/tunnel).

Install

pip install etunnel

Python >= 3.8 (websocket-client installed automatically).

CLI

etunnel 3000

Prints TUNNEL_URL: https://<subdomain>.t.etun.uk — that URL now routes to your local service. Ctrl-C closes the tunnel.

Reconnects automatically. If the connection drops (including a server restart) the CLI re-dials with exponential backoff (500ms → 30s, ±20% jitter, reset on success) and prints TUNNEL_URL: again. The subdomain is reclaimed, not re-randomised: the client replays the server's signed resumeToken in hello.resume, so links already shared keep working (the server needs a stable SESSION_SECRET; see PROTOCOL.md §1). Set ETUNNEL_RECONNECT=0 to restore the old one-shot behaviour.

Embed

from etunnel import connect
t = connect("wss://t.etun.uk/tunnel", 3000, {})
print(t["url"])

Environment variables

Variable Meaning Default
ETUNNEL_SERVER tunnel server WebSocket URL wss://t.etun.uk/tunnel
ETUNNEL_LOCAL local port or host:port (or 1st CLI arg) 3000
ETUNNEL_TOKEN paid-plan API key (optional) -
ETUNNEL_RECONNECT 0 disables auto-reconnect (one-shot CLI) enabled
ETUNNEL_SUBDOMAIN custom subdomain (paid plans) random

License

MIT — see LICENSE. Buffer-based protocol client: request and response bodies are buffered per stream (fine for webhooks/dashboards/demos; use the Go SDK for streaming and WebSocket pass-through).

Service terms

Use of the etunnel relay service (default wss://t.etun.uk/tunnel) is governed by its Terms of Service and Privacy Policy.

Multi-target routing

One public hostname, several local services - the SPA prod-bundle shape (/ to the built frontend, /api to the backend) without CORS or a second tunnel. Routing is client-side; the protocol is unchanged.

t = connect("wss://t.example.com/tunnel", opts={
    "routes": [
        {"prefix": "/api", "addr": "127.0.0.1:8080", "strip": True},
        {"prefix": "/", "addr": "127.0.0.1:3000"},
    ]
})

Semantics (identical in every SDK, pinned by tests): longest prefix wins; matching is on segment boundaries (/api never matches /apiv2); strip removes only the path part - the query string is carried over byte-for-byte, an exact hit bottoms out at /; no matching route (only possible without a / fallback) answers 404 at the SDK edge.

Redirect note: with strip, a backend 302 to an absolute path (/users/next) lands on the fallback route on the next hop - backends should return relative redirects or keep the prefix (same as nginx proxy_pass with trailing slash; see #155).

Metadata

Release files for etunnel 1.7.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for etunnel 1.7.13
File Size Uploaded Provenance Actions
etunnel-1.7.13.tar.gz 9.2 kB With provenance Details for etunnel-1.7.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for etunnel 1.7.13
File Interpreter ABI Platform Actions
etunnel-1.7.13-py3-none-any.whl Python 3 none any Details for etunnel-1.7.13-py3-none-any.whl

Total release size: 18.4 kB

Release files / etunnel-1.7.13.tar.gz

Download URL etunnel-1.7.13.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
23224e9a16729a7e307a49e8772a5527b6c93a8de54ae94d5b027197ecac3f03
BLAKE2b-256 checksum
How to use checksums
a905dbb87d34e978cc96153f950302a0b05bc1e687c1791da1790b92fd368d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / etunnel-1.7.13-py3-none-any.whl

Download URL etunnel-1.7.13-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2b8e0521625e0f2c3d68bc410d119f0f07673f0ff40dbe02201c137eaa6f2f0
BLAKE2b-256 checksum
How to use checksums
7deecaf84d65308f6f7b9e35d053f2e72e7d16d94e157d8940fc48181a5a4afb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for etunnel 1.7.13

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for etunnel-1.7.13.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.7.13 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page