Skip to main content

Run your Python server + Mekong tunnel in one command

Project description

mekong-tunnel

Run your Python server and a Mekong public tunnel together in a single command — no separate terminals, no manual port wiring.

What it is

mekong-tunnel is a lightweight CLI wrapper that:

  1. Starts your Python web server (uvicorn, Flask, Django, gunicorn, …).
  2. Waits until the server is actually listening on its port.
  3. Starts the mekong binary to create a public HTTPS tunnel to that port.
  4. Streams both processes' output to your terminal (prefixed with [server] / [tunnel]).
  5. Shuts both down cleanly on Ctrl-C.

Install

pip install mekong-tunnel

Note: mekong-tunnel does not bundle the mekong binary. You must install it separately (see below).

Usage

# FastAPI / uvicorn
mekong uvicorn main:app --reload --port 8000
mekong uvicorn main:app --reload          # port auto-detected (8000)

# Flask
mekong flask run --port 5000
mekong flask run                          # port auto-detected (5000)

# Django
mekong python manage.py runserver 8000
mekong python manage.py runserver         # port auto-detected (8000)

# Gunicorn
mekong gunicorn app:app --bind 0.0.0.0:8000

# Tunnel options
mekong --expire 2h uvicorn main:app --reload
mekong --no-qr  uvicorn main:app --port 8000
mekong --daemon uvicorn main:app --port 8000   # tunnel runs in background

# Help
mekong --help

CLI flags (consumed by mekong-tunnel)

Flag Description
--expire <val> Tunnel expiry, e.g. 2h, 30m
--no-qr Suppress QR code in tunnel output
--daemon Run tunnel as a background daemon
--help, -h Print help and exit

All other flags are passed through to your server command unchanged.

Installing the mekong binary

Download the appropriate binary for your platform from the GitHub releases page and place it on your PATH.

Linux / macOS (one-liner)

# Linux x86_64
curl -fsSL https://github.com/MuyleangIng/MekongTunnel/releases/download/v1.4.9/mekong-linux-amd64 \
  -o ~/.local/bin/mekong && chmod +x ~/.local/bin/mekong

# macOS Apple Silicon
curl -fsSL https://github.com/MuyleangIng/MekongTunnel/releases/download/v1.4.9/mekong-darwin-arm64 \
  -o ~/.local/bin/mekong && chmod +x ~/.local/bin/mekong

# macOS Intel
curl -fsSL https://github.com/MuyleangIng/MekongTunnel/releases/download/v1.4.9/mekong-darwin-amd64 \
  -o ~/.local/bin/mekong && chmod +x ~/.local/bin/mekong

Make sure ~/.local/bin is on your PATH:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc  # or ~/.zshrc
source ~/.bashrc

Windows

Download mekong-windows-amd64.exe from the releases page, rename it to mekong.exe, and place it in a directory that is on your %PATH% (e.g. %USERPROFILE%\AppData\Local\).

Requirements

  • Python 3.8 or later
  • The mekong binary installed separately (see above)

License

MIT

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

mekong_tunnel-1.0.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

mekong_tunnel-1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mekong_tunnel-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mekong_tunnel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 77c501e630c3e5b7cc64c6126e6a7f7e503bac95e714d7ba65285c892c79c626
MD5 36cfbc0c8db83562db9915d695ffed8a
BLAKE2b-256 13899bec00519112b5b762394540b8583265a31b66e87106d3a9c15036cdb226

See more details on using hashes here.

File details

Details for the file mekong_tunnel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mekong_tunnel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mekong_tunnel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84aae07f59f8f746f36f59fde5324a0b947890b505f96803c94948d2a9820eb8
MD5 3463d332061bed10af12194b6a4cc163
BLAKE2b-256 8ea9a00394d00fe3c8f5de817ab053dd53916a3d06dde5456bab05a6a5f2ab0a

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