Metadata-Version: 2.4
Name: mekong-tunnel
Version: 1.0.0
Summary: Run your Python server + Mekong tunnel in one command
License: MIT
Keywords: tunnel,mekong,uvicorn,fastapi,flask,django
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# mekong-tunnel

Run your Python server **and** a [Mekong](https://mekongtunnel.dev) 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

```bash
pip install mekong-tunnel
```

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

## Usage

```bash
# 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](https://github.com/MuyleangIng/MekongTunnel/releases/tag/v1.4.9) and place it on your `PATH`.

### Linux / macOS (one-liner)

```bash
# 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`:

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

### Windows

Download `mekong-windows-amd64.exe` from the [releases page](https://github.com/MuyleangIng/MekongTunnel/releases/tag/v1.4.9), 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
