A lightweight WireGuard-over-SOCKS5 management wrapper for Termux.
Termux WireProxy provides a simple command-line interface (twp) for managing a WireProxy-based VPN SOCKS5 proxy connection on Android using Termux.
The goal of this project is to make WireProxy easier to install, configure, start, stop, monitor, and troubleshoot from a mobile Linux environment.
- Simple
twpcommand interface - Automatic WireProxy dependency installation
- Provider/profile management
- Start, stop, and restart WireProxy
- Process and connection health checks
- Active configuration display
- VPN exit IP verification
- Log viewing and follow mode
- Version reporting
- Separation of public project files and private VPN credentials
Before installing, you need:
- Android device
- Termux
- A WireGuard-compatible VPN configuration file
Termux WireProxy uses:
- WireProxy to create a local SOCKS5 proxy from a WireGuard connection.
- WireGuard configuration files provided by your VPN provider or your own WireGuard server.
Your WireGuard configuration file contains private information such as cryptographic keys and should never be shared publicly.
Install Git if needed:
pkg install gitClone the project:
git clone https://github.com/UnB21/termux-wireproxy.gitEnter the project directory:
cd termux-wireproxyIf you cloned the repository using a different directory name, enter that directory instead.
Example:
cd termux-wireproxy-testYou can verify your current working directory at any time by running:
pwdExample output:
/data/data/com.termux/files/home/<your-project-directory>
Run:
./install.shThe installer will:
- Verify that it is running inside Termux
- Install WireProxy if it is missing
- Make the
twpcommand executable - Create the Termux command shortcut
After installation, verify:
twp versionThe version displayed should match the version in the project's VERSION file.
Run diagnostics:
twp doctorAfter installation, all project files are stored inside the directory you cloned.
To see the project files, run:
lsYou should see folders similar to:
bin
configs
lib
logs
providers
scripts
state
The most important directories are:
| Directory | Purpose |
|---|---|
providers/ |
Stores your private WireGuard configuration files |
configs/ |
Project configuration files |
scripts/ |
Internal scripts used by the twp command |
logs/ |
WireProxy log files |
state/ |
Runtime state information |
The providers/, logs/, and state/ directories may contain sensitive or runtime information.
WireGuard profiles contain private cryptographic keys and are intentionally excluded from Git tracking.
The state/ directory contains runtime-generated configuration and process information. It should not be committed to the repository.
All commands shown throughout this guide should be run from inside the project directory unless stated otherwise.
Termux WireProxy uses provider profiles.
A provider profile is a WireGuard configuration file stored inside the providers directory.
The expected layout is:
providers/
└── provider-name/
└── profile-name.conf
Example:
providers/
└── proton/
└── us.conf
The provider directory identifies the VPN provider or WireGuard server.
The profile filename identifies the specific WireGuard configuration.
A WireGuard profile is a configuration file supplied by your VPN provider or generated for your own WireGuard server.
The file usually has a .conf extension and contains information such as:
- Interface private key
- VPN address
- Server public key
- Server endpoint
- Allowed IP addresses
Example filename:
us.conf
Create a directory for your VPN provider:
mkdir -p providers/protonVerify that the directory was created:
ls providersExpected output:
proton
At this point, the provider directory exists but is empty.
Your WireGuard configuration file must be copied into that directory before it can be used.
Never upload your WireGuard configuration file to GitHub or share it publicly.
Your WireGuard profile contains private cryptographic keys and should be treated like a password.
Termux WireProxy requires a WireGuard client configuration file that connects to an existing WireGuard server.
There are two common ways to obtain one.
Many VPN providers allow downloading WireGuard configuration files from their account dashboard.
This is the easiest option because the provider already operates the WireGuard server.
You should download a WireGuard configuration intended for a WireGuard-compatible client.
The downloaded file will normally have a .conf extension.
If you want to host your own VPN server, you can generate WireGuard configurations using tools such as:
-
Nixpoin WireGuard Config Generator https://nixpoin.com/wireguard-generator/
-
ServerSpan WireGuard Generator https://www.serverspan.com/en/tools/wireguard
These tools can help generate WireGuard server or client configuration files.
You will still need:
- A VPS or server
- A public IP address
- A WireGuard server installation
- Proper server-side WireGuard configuration
A configuration generator does not create a VPN service by itself.
After generating your client configuration file, place it in:
providers/<provider>/<profile>.conf
Example:
providers/myserver/home.conf
Then activate it:
twp use myserver home.confPrefer tools that generate private keys locally and do not transmit private keys to third parties.
Review the privacy information of any configuration generator before trusting it with cryptographic material.
If you downloaded your WireGuard configuration using your Android web browser, it is usually saved in your Downloads folder.
To allow Termux to access Android storage, run:
termux-setup-storageWhen prompted, grant the requested storage permission.
Your Downloads folder will then be available at:
~/storage/downloads
List the downloaded files:
ls ~/storage/downloadsIf your configuration file is named us.conf, copy it into your provider directory:
cp ~/storage/downloads/us.conf providers/proton/Verify that it was copied successfully:
ls providers/protonExpected output:
us.conf
Your WireGuard configuration is now ready to be selected by Termux WireProxy.
Because the profile contains a private key, restrict its permissions:
chmod 600 providers/proton/us.confVerify the permissions:
stat -c '%a %n' providers/proton/us.confExpected output:
600 providers/proton/us.conf
List available provider profiles:
twp providersThis command displays the provider directories and available profiles that Termux WireProxy can use.
The twp use command expects two arguments:
twp use <provider> <profile>
<provider>is the name of the directory insideproviders/<profile>is the name of the WireGuard configuration file
For example, if your project looks like this:
providers/
└── proton/
└── us.conf
Run:
twp use proton us.confAnother example:
providers/
└── myserver/
└── home.conf
Run:
twp use myserver home.confAfter selecting a profile, verify the active configuration:
twp currentRun diagnostics:
twp doctorThe following example demonstrates a complete first-time setup after installation.
Create a provider directory:
mkdir -p providers/myvpnCopy your WireGuard configuration file into that directory:
providers/myvpn/home.conf
Select the profile:
twp use myvpn home.confVerify the active configuration:
twp currentRun diagnostics:
twp doctorStart WireProxy:
twp startCheck that WireProxy is running:
twp statusRun the health check:
twp healthVerify your VPN exit IP:
twp ipIf everything is configured correctly, the reported exit IP should correspond to the VPN connection rather than your normal network connection.
Termux WireProxy does not require a static WireProxy configuration file to be stored in the repository.
When WireProxy is started, Termux WireProxy generates the active runtime configuration inside the state/ directory.
For example:
state/
└── wireproxy.conf
The runtime configuration is generated from the currently selected provider and profile.
A typical generated configuration looks similar to:
WGConfig = /data/data/com.termux/files/home/termux-wireproxy/providers/proton/example.conf
[Socks5]
BindAddress = 127.0.0.1:25344
The exact path depends on your project location and selected provider profile.
The generated runtime configuration contains the path to your private WireGuard profile.
Keeping the runtime configuration outside Git provides a cleaner separation between:
- Public project files
- Private WireGuard credentials
- Local user configuration
- Runtime state
The state/ directory is therefore intentionally ignored by Git.
Run:
twp healthThe health check verifies important parts of the active connection, including:
- WireProxy process availability
- SOCKS5 proxy availability
- VPN exit IP availability
To check your VPN exit IP directly:
twp ipA healthy connection should report an exit IP associated with the configured VPN connection.
The twp command manages WireProxy without requiring you to manually run WireProxy commands.
twp starttwp stoptwp restarttwp statustwp healthtwp doctortwp currenttwp iptwp logstwp logs -ftwp providerstwp use <provider> <profile>Example:
twp use proton us.conftwp versionAfter a profile has been configured, a normal workflow is:
twp current
twp doctor
twp start
twp status
twp health
twp ipTo stop the connection:
twp stopTo restart it:
twp restartTo investigate a problem:
twp doctor
twp status
twp logsRun the installer again:
./install.shThen verify:
twp versionIf the command still cannot be found, verify that the Termux command directory is available:
echo "$PREFIX/bin"You can also verify that the twp command exists:
ls -l "$PREFIX/bin/twp"Run:
./install.shThe installer will install WireProxy automatically if it is not already installed.
You can also verify manually:
wireproxy --versionThis usually means Termux WireProxy could not find the WireGuard configuration file it expects.
First, list your provider directories:
ls providersThen list the profiles inside your provider directory:
ls providers/protonVerify the currently selected configuration:
twp currentRun diagnostics:
twp doctorIf you selected the wrong provider or profile, activate the correct one:
twp use <provider> <profile>Example:
twp use proton us.confRun:
twp doctorThen check the logs:
twp logsYou can also check the current status:
twp statusRestart if needed:
twp restartIf twp doctor reports that SOCKS5 is unavailable:
Check status:
twp statusReview logs:
twp logsRestart WireProxy:
twp restartThen run the health check again:
twp healthRun:
stat -c '%a %n' providers/proton/*.confPrivate WireGuard profiles should normally be restricted to the owner.
For example:
chmod 600 providers/proton/us.confVerify again:
stat -c '%a %n' providers/proton/us.confExpected:
600 providers/proton/us.conf
You can also use:
twp doctorThe security diagnostics should report that the WireGuard profile permissions are protected.
Never commit a private WireGuard profile.
Check whether Git is tracking any provider profiles:
git ls-files 'providers/**/*.conf'A correctly protected repository should not list private WireGuard profiles.
Check the repository status:
git status --shortThe .gitignore file intentionally excludes private provider configuration files.
Private files are intentionally excluded from Git tracking.
Ignored files include:
providers/**/*.conf
configs/project.local.conf
logs/
state/
Never upload:
- WireGuard configuration files
- Private keys
- VPN credentials
- Runtime configuration files
- Other files containing secrets
Treat your WireGuard profile the same way you would treat a password.
The project uses Git ignore rules to help prevent private WireGuard profiles from being committed.
You should still verify Git status before committing changes:
git status --shortYou can check tracked provider files with:
git ls-files 'providers/*'Private .conf files should not appear in the tracked-file list.
Termux WireProxy's diagnostic system checks important file permissions.
Run:
twp doctorA healthy security section should report protected permissions for:
- Project directory
- Provider directory
- WireGuard profile
- Local configuration
- Runtime configuration
If you are developing or modifying Termux WireProxy, you can inspect what Git is tracking with:
git ls-filesCheck tracked configuration files:
git ls-files 'configs/*'Check tracked provider files:
git ls-files 'providers/*'Check ignored runtime files:
git status --short --ignoredCheck the provider directory structure:
find providers -maxdepth 2 -type f -printf '%M %p\n' | sortCheck runtime state:
find state -maxdepth 1 -type f -printf '%M %p\n' | sortCheck the current runtime:
twp currentCheck connection health:
twp healthRun the complete diagnostic system:
twp doctorTermux WireProxy is designed to be developed directly from Termux.
The project separates:
Public project files
|
+-- bin/
+-- configs/
+-- docs/
+-- lib/
+-- scripts/
+-- README.md
+-- LICENSE
+-- VERSION
Private/local files
|
+-- providers/*.conf
+-- configs/project.local.conf
+-- logs/
+-- state/
Private configuration and runtime data should remain local to the user's Termux environment.
Before committing changes, review:
git statusThen inspect the changes:
git diffIf changes are ready to commit:
git add -AReview the staged changes:
git diff --cachedOnly commit after verifying that no private credentials or runtime files are staged.
Current version:
0.3.7
The authoritative project version is stored in:
VERSION
You can check it with:
cat VERSIONYou can also display the installed project version with:
twp versionThis project is actively under development.
This project is licensed under the MIT License.
See the LICENSE file for details.