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 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, 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
Metadata
Release files for foxyvpn 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| foxyvpn-1.0.2.tar.gz | 45.0 kB | Without provenance | Details for foxyvpn-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| foxyvpn-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for foxyvpn-1.0.2-py3-none-any.whl |
Total release size: 99.1 kB
Release files / foxyvpn-1.0.2.tar.gz
| Download URL | foxyvpn-1.0.2.tar.gz |
|---|---|
| Size | 45.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88e14fb901dd1e843455f00f2c547add0c27d6cdc5be86ec383f0fb62d2763ef
|
|
BLAKE2b-256 checksum How to use checksums |
01fe37b93582efd67e1b7a857e87d922530cd8d04e3e7a94e76d0115535e9f08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / foxyvpn-1.0.2-py3-none-any.whl
| Download URL | foxyvpn-1.0.2-py3-none-any.whl |
|---|---|
| Size | 54.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42114bfd7f4bdaecd2005a1eef4152f4656a456f11ae05d29615ecbaa1be22b8
|
|
BLAKE2b-256 checksum How to use checksums |
179e1b6baee207fb7dbaba3cb70a4ec97053371380157cd81bb11a749ce197d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for foxyvpn 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.