Skip to main content

FoxyVPN

A standalone Python client and local SOCKS5 proxy for the Mozilla VPN / Firefox VPN proxy service, distributed as a standard PyPI package.

This is an independent Python rewrite of firefox-vpn-client (originally written in Go). It reimplements the same Firefox Accounts authentication, Mozilla VPN "Guardian" control plane, Fastly anti-bot challenge solver, and local SOCKS5-over-HTTP/2 or HTTP/3 proxy, packaged as an installable pip package with a console entry point and an automated release workflow.

Disclaimer: This is an unofficial, community client. It is not affiliated with or endorsed by Mozilla. Use it only with an account and subscription you are authorized to use, and in accordance with Mozilla VPN's terms of service.

Features

  • Firefox Accounts login (email + password, with email 2FA code verification, falling back to a confirmation-link prompt if FxA requires it) or reuse of pre-provisioned session tokens, with automatic rotation across a pool of tokens.
  • Cached OAuth tokens (~/.foxyvpn-tokens.json, written with 0600 permissions) with automatic refresh.
  • Automatic solving of Fastly's client-side anti-bot "Client Challenge" (proof-of-work, Private Access Token probing, and client-metrics beacons), including on Hawk-signed FxA requests, where the request signature is rebuilt fresh on every retry.
  • Mozilla VPN "Guardian" proxy-pass issuance, renewal, quota monitoring, and account entitlement lookups, including clock-skew-tolerant JWT expiry parsing.
  • VPN server list discovery via Firefox Remote Settings, with country/city selection (defaulting to Firefox's own recommended "REC" server when no country is given) and a persisted proxy-state file across restarts, including clearing a persistently failing proxy selection after repeated connection failures.
  • A local SOCKS5 (RFC 1928, CONNECT-only) proxy that tunnels traffic to the upstream Mozilla VPN proxy node over HTTP/2 (default) or HTTP/3 (--http3), with connection pooling, client-IP affinity across multiple upstream connections, idle timeouts, and a maximum-connections limit.
  • Non-fatal exit-IP/country verification after connecting.
  • Optional JSON status file describing the current proxy-pass health, for supervisord/systemd-style monitoring.
  • Structured logging (text or JSON) to stderr.

Installation

pip install foxyvpn

Or, from a source checkout:

pip install .

That's it — both HTTP/2 and HTTP/3 (--http3) upstream transports are included in the base install; there is no separate extra to opt into.

Usage

# First run: interactive Firefox Accounts login, auto-selects a proxy server.
foxyvpn --country us

# Force a fresh login instead of reusing cached tokens.
foxyvpn --login --country us

# Use a specific upstream proxy instead of country-based selection.
foxyvpn --proxy us1.example.com:443

# Authenticate with a pre-provisioned session token (or a file with one
# token per line for automatic rotation on quota exhaustion).
foxyvpn --session-token /path/to/tokens.txt --country de

# Use HTTP/3 (QUIC) for the upstream tunnel instead of HTTP/2.
foxyvpn --http3 --country us

# Print account entitlement info and exit.
foxyvpn --print-info

# Print the available server list and exit.
foxyvpn --list-servers

Once running, point any SOCKS5-aware client at the local listener (default 127.0.0.1:1080):

curl --socks5-hostname 127.0.0.1:1080 https://example.com

CLI flags

Flag Default Description
--api-proxy (none) Proxy URL used only for FxA/Guardian/Remote-Settings control-plane calls.
--guardian https://vpn.mozilla.org Guardian (Mozilla VPN control plane) endpoint.
--listen 127.0.0.1:1080 Local SOCKS5 listen address (host:port, or [ipv6]:port).
--login off Force a fresh interactive login, ignoring cached tokens.
--email (prompted) Firefox Accounts email.
--session-token (none) Session token or path to a token-pool file.
--print-info off Print entitlement info and exit.
--list-servers off Print the server list and exit.
--proxy (none) Exact upstream host:port (mutually exclusive with --country).
--country (none) Two-letter country code for proxy selection. Defaults to the recommended REC server (auto-selected by Firefox) when omitted.
--timeout 20 Default request timeout (seconds) for FxA/Guardian/Remote-Settings control-plane calls.
--handshake-timeout 10 Upstream TLS/HTTP2/QUIC handshake timeout (seconds).
--http3 off Use HTTP/3 (QUIC over UDP) instead of HTTP/2 for the upstream tunnel.
--idle-timeout 0 (disabled) Idle connection timeout (seconds).
--max-conns 256 Max concurrent SOCKS5 client connections; 0 disables the limit.
--upstream-conns 1 Number of pooled upstream sessions (client-IP affinity when >1).
--status-file (none) Path to a JSON proxy-pass health status file.
--proxy-state-file (none) Path to persist the selected upstream proxy.
--verify-exit / --no-verify-exit on Verify the exit country after connecting.
--exit-check-url https://www.cloudflare.com/cdn-cgi/trace URL used for exit verification.
--exit-check-timeout 10 Timeout for the exit-check request (seconds).
--verbose off Shorthand for --log-level debug.
--log-level info debug, info, warn, or error.
--log-format text text or json.
--version Print version information and exit.

Development

There is no automated test suite: the login, 2FA, quota-exhaustion, and challenge-solving flows all require a real Firefox Account and live Mozilla VPN entitlement, which can't run unattended in CI. Local changes are verified by building and inspecting the package instead:

pip install -e ".[dev]"
python -m build
python -m twine check dist/*

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foxyvpn-1.0.2.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

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

foxyvpn-1.0.2-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file foxyvpn-1.0.2.tar.gz.

File metadata

  • Download URL: foxyvpn-1.0.2.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for foxyvpn-1.0.2.tar.gz
Algorithm Hash digest
SHA256 88e14fb901dd1e843455f00f2c547add0c27d6cdc5be86ec383f0fb62d2763ef
MD5 46f00a86173bfd951b9f89d9d1fbebb9
BLAKE2b-256 01fe37b93582efd67e1b7a857e87d922530cd8d04e3e7a94e76d0115535e9f08

See more details on using hashes here.

File details

Details for the file foxyvpn-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: foxyvpn-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for foxyvpn-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42114bfd7f4bdaecd2005a1eef4152f4656a456f11ae05d29615ecbaa1be22b8
MD5 284545ee60fd9896264f5953e796e4a0
BLAKE2b-256 179e1b6baee207fb7dbaba3cb70a4ec97053371380157cd81bb11a749ce197d0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

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