mystui

command module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ยถ

mystui

A terminal front end for the Mysterium VPN CLI. It runs mystvpn and a SOCKS5 proxy in a Docker container, so the VPN only carries the traffic you send through the proxy. The rest of your machine stays outside the tunnel, which gives you split tunneling without a split-tunnel feature in the VPN itself. The interface is built with Bubble Tea and Lip Gloss.

Mysterium VPN

container up   socks5 open 127.0.0.1:1080
vpn connected (residential)   exit 203.0.113.7  Berlin ๐Ÿ‡ฉ๐Ÿ‡ช DE
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Countries  residential IPs  52 available
 ๐Ÿ‡ฆ๐Ÿ‡ฑ Albania      ๐Ÿ‡ฆ๐Ÿ‡ท Argentina    ๐Ÿ‡ฆ๐Ÿ‡บ Australia    ๐Ÿ‡ฆ๐Ÿ‡น Austria
โ—๐Ÿ‡ฉ๐Ÿ‡ช Germany      ๐Ÿ‡ฌ๐Ÿ‡ท Greece       ๐Ÿ‡ญ๐Ÿ‡บ Hungary      ๐Ÿ‡ฎ๐Ÿ‡ช Ireland
 ...

enter connect   d disconnect   f refresh   t ip type   a sign in   L sign out
u start container   x stop container   c chrome via proxy   ? short help   q quit

Prerequisites

  • A Mysterium VPN subscription.
  • Docker with Compose. The Docker host needs a kernel with WireGuard: a Linux host, or on macOS a VM such as Colima. Docker Desktop is untested.
  • Go, only to build the binary.
  • Optional: Google Chrome or Chromium, for the c key.

Installation

go install github.com/audivir/mystui@latest

Or from a clone:

git clone https://github.com/audivir/mystui
cd mystui
go build -o ~/.local/bin/mystui .

Binaries for Linux, macOS, and Windows are attached to each GitHub release.

Make sure the install directory (~/.local/bin, or $(go env GOPATH)/bin for go install) is on your PATH.

Usage

First run
mystui
  1. Press u. The first run builds the container image, which takes a few minutes. The Dockerfile and compose file are embedded in the binary and written to ~/.local/share/mystui (or below $XDG_DATA_HOME).
  2. Press a. The sign-in URL is printed; open it in your browser and approve. The link expires after 5 minutes.
  3. Pick a country with the arrow keys and press enter.
  4. Use the proxy at socks5h://127.0.0.1:1080 (set MYSTUI_PORT to change the port), or press c to open Chrome through it.

The h in socks5h makes DNS lookups go through the proxy as well. Example:

curl -x socks5h://127.0.0.1:1080 https://api.ipify.org
Keys
Key Action
โ† โ†‘ โ†“ โ†’ or h j k l move through the countries
enter connect to the selected country
d disconnect
f refresh (reconnect with the saved country)
t switch between residential and hosting IPs
a / L sign in / sign out
u / x start / stop the container
c open Chrome through the proxy
C clear the separate Chrome profile (asks first)
r reload
? show all keys or the short list
q quit
Command line

Every key also exists as a command, for scripts and SSH sessions:

mystui status                      # container, proxy and VPN; exit code 1 unless connected
mystui connect AT                  # country as two letters, residential by default
mystui connect --ip-type hosting DE
mystui disconnect
mystui signin                      # prints the approval link, then waits
mystui signout
mystui up                          # build the image and start the container (key u)
mystui down                        # stop the container (key x)
mystui chrome                      # a separate profile if Chrome is already running
mystui clear [-y]                  # delete the separate Chrome data, after a yes unless -y is given

A command exits with 1 when the key would show an error, and with 2 for wrong arguments. connect replaces a lost tunnel like the reconnect key does.

Chrome

c opens Chrome with the proxy flags on your normal profile, so your logins and extensions are available. Chrome applies --proxy-server only when it starts a new instance. If Chrome is already running on that profile, the TUI asks whether to open a separate proxied profile (~/.local/share/mystui/chrome) instead. C deletes only that separate profile, never your normal one.

Configuration
Variable Meaning Default
MYSTUI_DIR directory for the generated files, the data, and the Chrome profile $XDG_DATA_HOME/mystui, else ~/.local/share/mystui
MYSTUI_PORT host port of the SOCKS5 proxy; it is only published on 127.0.0.1 1080
MYSTUI_CHROME_PROFILE Chrome profile that c opens your normal Chrome profile
MYSTUI_FLAGS 1 or 0 forces flag emoji on or off on for UTF-8 locales

Changing MYSTUI_PORT takes effect when the container is recreated: press u.

Where things live
Path Contents
~/.local/share/mystui/docker/ Dockerfile and compose.yaml, rewritten from the binary on every start and stop
~/.local/share/mystui/data/ sign-in tokens and the WireGuard keypair, mounted into the container; keep it private
~/.local/share/mystui/chrome/ the separate Chrome profile, created on demand
~/.local/share/mystui/iptype the IP type of the current connection, which the VPN CLI does not report

To remove everything: stop the container with x, run docker rmi on the built image, and delete ~/.local/share/mystui (or below $XDG_DATA_HOME).

Tunnel recovery and kill-switch

The container survives a sleep of the host, but the tunnel behind it can die: mystvpn status shows the saved state, and the WireGuard interface stays after the exit node stops answering.

  • mystui marks the VPN as lost when the newest handshake is older than 5 minutes, and shows connection lost. While it is open, it reconnects with the saved country, at most every 2 minutes.
  • Inside the container, watchdog.sh does the same with the TUI closed. It records the last connect through a wrapper around mystvpn, so a disconnect from the TUI is respected.
  • killswitch.sh runs the SOCKS5 proxy as its own user and rejects its traffic unless it leaves through the tunnel. While the tunnel is down or replaced, the proxy fails instead of exposing the address of the host. UDP except DNS may leave through any interface, because the encrypted packets of the tunnel itself count as traffic of the proxy user.
Limitations
  • The VPN CLI chooses the city; you can only pick the country and the IP type.
  • The country list needs a signed-in session. Without one the TUI says so.
  • On Windows, the check for a running Chrome only sees the normal profile.
  • The mystvpn version is pinned in docker/Dockerfile (MYSTVPN_VERSION).

Development

go test ./...
uvx prek run -a

The package mystvpn (status parsing, tunnel and handshake checks, the reconnect, and the scripts for the container) is also imported by mystgw, a private tool that runs one such container per country. Keep it free of anything specific to either tool. The scripts are embedded in the package, and writeFiles writes them next to the Dockerfile, which copies them into the image. A change to a script only reaches the container after u rebuilds the image.

TestStaleConnectionAfterRestart and the tests that follow it run against a fake docker script (fakeDocker in main_test.go), so they need no daemon. They cannot show the behavior of a real tunnel or of the kill-switch rules. Check those by hand: put the Mac to sleep with the VPN connected, and wake it.

License

MIT. The Mysterium VPN CLI that runs inside the container is a separate program under its own license (GPL-2.0).

Documentation ยถ

Overview ยถ

Command mystui is a terminal front end for the Mysterium VPN CLI running in Docker.

Directories ยถ

Path Synopsis
Package mystvpn stores the helpers that mystui and mystgw share to drive mystvpn in a container.
Package mystvpn stores the helpers that mystui and mystgw share to drive mystvpn in a container.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL