Skip to main content

VPN Proxy Exchange — CLI wrapper for the VPNX Docker container

Project description

VPNX

VPN Proxy Exchange

Self-hosted rotating VPN proxy in a single Docker container. Free public VPN servers → SOCKS5 + HTTP proxy → REST API control.

Version Docker License


How It Works

┌─────────────────────────────────────────────────┐
│                   Docker Container               │
│                                                   │
│   ┌─────────┐    ┌───────────┐    ┌───────────┐  │
│   │ OpenVPN │───▶│  tun0     │───▶│   Dante   │  │
│   │ (VPN    │    │  (tunnel  │    │  SOCKS5   │  │
│   │  Gate)  │    │   iface)  │    │   :1080   │  │
│   └─────────┘    └───────────┘    └─────┬─────┘  │
│                                         │        │
│                                   ┌─────▼─────┐  │
│                                   │ TinyProxy │  │
│                                   │  HTTP     │  │
│                                   │  :8080    │  │
│                                   └─────┬─────┘  │
│                                         │        │
│   ┌─────────────────────────────────────▼──────┐ │
│   │            FastAPI :8000                    │ │
│   │  /connect  /rotate  /status  /locations    │ │
│   └────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
         ▲                              ▲
         │ curl / SDK                   │ curl --socks5 / -x
    Your API client              Your proxy client

VPNX downloads free OpenVPN configs from VPN Gate, creates a VPN tunnel, and routes all proxy traffic through it. Rotate servers or switch countries via REST API — no VPN client needed on your machine.

Quick Start

docker run -d --name vpnx \
  --cap-add=NET_ADMIN --device=/dev/net/tun \
  -p 1080:1080 -p 8080:8080 -p 8000:8000 \
  -e API_TOKEN=your-secret \
  mocasus/vpnx:latest

That's it. VPNX is now running:

  • SOCKS5 proxylocalhost:1080
  • HTTP proxylocalhost:8080
  • REST APIlocalhost:8000

Install (CLI wrapper)

Method Command
npm npm install -g @mocasus/vpnx && vpnx your-secret
pip pip install vpnx-cli && vpnx your-secret
Docker Compose git clone https://github.com/mocasus/vpnx && cd vpnx && docker compose up -d

The CLI wrapper generates a token, pulls the image, and starts the container with the right flags.

API Reference

All endpoints require Authorization: Bearer <API_TOKEN> header.

Method Endpoint Description
POST /login Get proxy credentials (username/password)
GET /status VPN connection + proxy status
POST /connect?country=JP Connect to VPN (optional country code)
POST /rotate?country=US Rotate to a different VPN server
GET /locations List available VPN servers by country

Examples

# Get proxy credentials
curl -X POST http://localhost:8000/login \
  -H "Authorization: Bearer your-secret"

# Connect to Japan VPN
curl -X POST "http://localhost:8000/connect?country=JP" \
  -H "Authorization: Bearer your-secret"

# Rotate to a US server
curl -X POST "http://localhost:8000/rotate?country=US" \
  -H "Authorization: Bearer your-secret"

# Check status
curl http://localhost:8000/status \
  -H "Authorization: Bearer your-secret"

Using the Proxy

# SOCKS5
curl --socks5 user:pass@localhost:1080 https://ifconfig.me

# HTTP proxy
curl -x http://user:pass@localhost:8080 https://ifconfig.me

Works with any tool that supports SOCKS5 or HTTP proxies — browsers, scrapers, HTTP clients, etc.

Configuration

Env Var Default Description
API_TOKEN (required) Bearer token for API authentication
SOCKS_USER vpnx<random> SOCKS5/HTTP proxy username
SOCKS_PASS <random> SOCKS5/HTTP proxy password

Requirements

  • Docker (or Podman with --cap-add=NET_ADMIN)
  • Linux host with /dev/net/tun available
  • NET_ADMIN capability (for creating TUN interfaces)

Tech Stack

  • OpenVPN — VPN tunnel via VPN Gate public servers
  • Dante — SOCKS5 proxy with username/password auth
  • TinyProxy — HTTP proxy with BasicAuth
  • FastAPI — REST API for control plane
  • Supervisor — Process management inside container

🇮🇩 Bahasa Indonesia

VPN Proxy Exchange — proxy VPN berputar dalam satu container Docker.

Unduh konfigurasi OpenVPN publik gratis (VPN Gate), arahkan lalu lintas melalui SOCKS5 dan HTTP proxy, kontrol via REST API.

Mulai Cepat

docker run -d --name vpnx \
  --cap-add=NET_ADMIN --device=/dev/net/tun \
  -p 1080:1080 -p 8080:8080 -p 8000:8000 \
  -e API_TOKEN=rahasia-anda \
  mocasus/vpnx:latest

Pemasangan

Metode Perintah
npm npm install -g @mocasus/vpnx && vpnx rahasia-anda
pip pip install vpnx-cli && vpnx rahasia-anda
Docker Compose git clone https://github.com/mocasus/vpnx && cd vpnx && docker compose up -d

API

Semua endpoint butuh header Authorization: Bearer <API_TOKEN>.

Method Endpoint Keterangan
POST /login Dapatkan kredensial proxy (user/pass)
GET /status Status VPN + proxy
POST /connect?country=JP Hubungkan ke VPN (kode negara opsional)
POST /rotate?country=US Rotasi ke server VPN lain
GET /locations Daftar server VPN per negara

Contoh

# Dapatkan kredensial proxy
curl -X POST http://localhost:8000/login \
  -H "Authorization: Bearer rahasia-anda"

# Hubungkan ke VPN Jepang
curl -X POST "http://localhost:8000/connect?country=JP" \
  -H "Authorization: Bearer rahasia-anda"

# Rotasi ke server US
curl -X POST "http://localhost:8000/rotate?country=US" \
  -H "Authorization: Bearer rahasia-anda"

Menggunakan Proxy

# SOCKS5
curl --socks5 user:pass@localhost:1080 https://ifconfig.me

# HTTP proxy
curl -x http://user:pass@localhost:8080 https://ifconfig.me

Konfigurasi

Env Var Default Keterangan
API_TOKEN (wajib) Token Bearer untuk autentikasi API
SOCKS_USER vpnx<random> Username proxy SOCKS5/HTTP
SOCKS_PASS <random> Password proxy SOCKS5/HTTP

Kebutuhan Sistem

  • Docker (atau Podman dengan --cap-add=NET_ADMIN)
  • Host Linux dengan /dev/net/tun
  • Capability NET_ADMIN (untuk membuat interface TUN)

v1.0.0 · MIT License

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

vpnx_cli-1.0.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

vpnx_cli-1.0.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vpnx_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cedb4622361fa9c83bfd7e490ebc1073b5c875496ba2456656412736194148bd
MD5 0fc5723ae8a427c4d300da9579feab21
BLAKE2b-256 3257c3d6b9f2cdf8a6c25e456128aac9633790c10a8fac5b9798aafb7ffbe52c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vpnx_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1406702dbbf0cec23ec593cbd1628e6fee53f4edb9f972608c093878efcb88e
MD5 aef19e86c1e1dd815f0053bd0fa502b1
BLAKE2b-256 2d9b6622bf66252ddd49af2aa5d0719c1e693416eebf4680fdb948450fb6ee12

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