Skip to main content

Mullvad Setup

odirscan requires an active Mullvad VPN connection to route scan requests through SOCKS5 proxies on Mullvad relay servers.

Prerequisites

  1. A Mullvad VPN subscription.
  2. The Mullvad client connected to a WireGuard server before starting odirscan.

Connection Check

At startup, Scanner.New() calls mullvad.IsConnected(), which makes a request to:

https://am.i.mullvad.net/json

The response includes a mullvad_exit_ip boolean field. If this is true, odirscan proceeds to start the relay list updater. If the check fails or the VPN is not connected, the program exits with a fatal error.

Relay List Updater

Once the VPN is confirmed active, StartUpdater() performs an initial fetch of the Mullvad relay list and then checks for updates on a configurable interval (default: 1 hour).

The updater:

  1. Sends an HTTP HEAD request to the relay API endpoint to check ETag and Last-Modified headers.
  2. Compares against locally cached metadata (relays.meta.json).
  3. If the remote list is newer (or no local copy exists), downloads the full relay list to relays.json.
  4. Parses the relay list into memory for proxy selection.

Subsequent checks run in a background goroutine.