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 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 with0600permissions) 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.
- A local SOCKS5 (RFC 1928, CONNECT-only) proxy that tunnels traffic to the upstream Mozilla VPN proxy node over HTTP/2, 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 .
HTTP/3 (QUIC) upstream support is optional:
pip install "foxyvpn[http3]"
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
# 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 handshake timeout (seconds). |
--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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file foxyvpn-1.0.0.tar.gz.
File metadata
- Download URL: foxyvpn-1.0.0.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dbea5217eb90fe3fd14aec5712bdc7bb7558887668c30aa11e374180851bcaf
|
|
| MD5 |
74cecf8dc3f774a940eacfe5c21b0a3a
|
|
| BLAKE2b-256 |
184def4735de5566862283d7636f8ac8e59e4a49376987267166d025e98bbdb3
|
File details
Details for the file foxyvpn-1.0.0-py3-none-any.whl.
File metadata
- Download URL: foxyvpn-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82a72d04713488697fab1a85a2d5215b628e76bd74e0734690d2cd3093733e45
|
|
| MD5 |
cea044cc4b34263451bbb05f5c7c9f93
|
|
| BLAKE2b-256 |
1e32964a8422936789b606d0827dacd82f21590991c155e477dabb349314ea9a
|