mullvad-best-server/README.md
Thorsten Schubert ab04f13e9d
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Pack structs for minimal memory usage
2023-09-21 19:25:35 +02:00

1.9 KiB

mullvad-best-server

status-badge

Determines the mullvad.net server with the lowest latency concurrently.

Installation

No pre-compiled binary is supplied at the moment.

From source

  • Clone repository
  • make build or go build -ldflags="-s -w" .

Usage

When executing mullvad-best-server it will retrieve a list of mullvad servers from the public API and issue ICMP packets to determine the server with the lowest latency. It then outputs the server code, e.g. de05 on success.

Command line parameters

Usage of mullvad-best-server:
  -api-timeout duration
    	API timeout (default 10s)
  -country string
    	Relay country code (ISO 3166 ALPHA-2), e.g. 'de' for Germany
  -interval duration
    	Packet interval (default 200ms)
  -json
    	Output result as JSON
  -log string
    	Log level. Allowed values: trace, debug, info, warn, error, fatal, panic (default "warn")
  -packets int
    	Number of packets per relay (default 16)
  -provider string
    	Relay provider, e.g. 31173 for mullvad owned relays
  -rtt string
    	Minimum (min) or Average (avg) time for RTT latency (default "avg")
  -threads int
    	Number of relays processed concurrently (batch) (default 32)
  -timeout duration
    	Ping timeout (default 200ms)
  -warmup
    	Warmup phase (default true)

If you want the full server information, execute mullvad-best-server -json, it returns the full JSON server object.

Background

The program uses https://api.mullvad.net/www/relays/<SERVER_TYPE>/ to get the current server list, filters them by the supplied arguments and outputs the server with the lowest latency.

Example

Using the official Mullvad CLI

mullvad relay set location "$(mullvad-best-server -country de -provider=31173 -warmup)" \
  && mullvad connect