This document explains how to use the Go-based encrypted tunnel system.
You can now run the VPN as a native macOS application:
- Download or Build the project.
- Double-click
SecureTunnel.app. - Enter your administrator password when prompted.
- Look for the ๐โ icon in your menu bar (top right).
- Control: Use the menu bar icon to Pause, Resume, or Show Logs.
- Stop: Select Esci from the menu bar icon or press
Cmd+Q.
- Go 1.18+ (Required only for building)
- Swift (Available by default on macOS)
To build everything (the VPN binary, the status bar utility, and the .app bundle):
./build_app.shIf you prefer the terminal, you can still use the automation script:
- Double-click
run_vpn.command. - Enter your password when prompted (required to change network settings).
- Press P from yourkeyboard to pause/resume the Tunneling.
- To stop: Press CTRL+C in the terminal window or close all terminal windows with CMD+Q.. in both cases, the proxy will be automatically disabled.
Or..
This mode creates a local proxy (port 1080) that tunnels traffic to the server safely without sudo.
-
Start Server (no sudo needed for this mode, but sudo enables fallback to TUN):
./vpn -mode server -port 3000 -secret mysecret
-
Start Client (Proxy Mode):
./vpn -mode socks -server 127.0.0.1 -port 3000 -socks 1080 -secret mysecret
-
Configure Safari / System:
- Go to System Preferences > Network > Advanced > Proxies.
- Check SOCKS Proxy.
- Server:
127.0.0.1, Port:1080. - Click OK > Apply.
-
Verify:
To run the VPN automatically when you log in:
- Open System Settings -> General -> Login Items.
- Click the
+button in the "Open at Login" section. - Navigate to your project folder and select
run_vpn.commandorSecureTunnel.app. - Note: Upon login, a terminal window will open and ask for your password to activate the proxy.
Authentication is strictly enforced using mTLS.
- Client Side: Must present a valid
client.crtsigned by your private CA. - Server Side: Verifies the client certificate before accepting any connection.
- Benefit: Immune to password brute-forcing and unauthorized scanning.
The Server automatically resolves domain names using Cloudflare (1.1.1.1) via encrypted HTTPS.
- Benefit: Your ISP cannot see your DNS queries (hides which sites you visit).
- Log Message:
[SEC] Resolving example.com via DoH...
The VPN Client includes a built-in Tracker Blocker that actively filters specific tracking domains.
- Mechanism: Checks requests against a local blocklist before they leave your machine.
- Benefit: Blocks ads and trackers at the source, saving bandwidth and protecting privacy.
- Log Message:
[BLOCK] Connection denied (Client-side): doubleclick.netThe server listens for incoming connections and acts as the tunnel endpoint.
# Listen on port 3000 (default) with a shared secret
./vpn -mode server -port 3000 -secret mysecretNote: The server uses a self-signed certificate generated on startup.
The client connects to the server and creates a TUN interface (e.g., utun3).
# Connect to server
sudo ./vpn -mode client -server 127.0.0.1 -port 3000 -secret mysecretNote: Sudo is required to create the TUN interface.
Since this is a prototype, routing rules are not securely applied automatically to prevent locking you out of the system.
Once the client is running, you will see a message like:
Interface utun3 created
You need to assign an IP and set up routes in a separate terminal:
-
Assign IP to Tunnel:
# Replace utun3 with your actual interface name sudo ifconfig utun3 10.0.0.2 10.0.0.1 up -
Route Traffic: To route specific traffic (e.g., to a specific IP) through the tunnel:
sudo route add <DESTINATION_IP> 10.0.0.1
To route ALL Internet Traffic (VPN):
[!WARNING] Doing this incorrectly can disconnect your internet.
- Add specific route to VPN Server IP via your Gateway (to avoid loops).
- Delete default route.
- Add default route via
10.0.0.1.
On Client:
curl -v --socks5 127.0.0.1:1080 https://www.google.comIf you get a response and see [INFO] SOCKS Request... in your valid VPN terminal, it works!
Want to see the matrix? You can prove the traffic is encrypted by sniffing your own loopback interface:
sudo tcpdump -i lo0 -X port 3000What to look for:
- Gibberish: The data columns (right side) should look like random characters (
...T...F.E>.?...). This is good! It means the payload is encrypted. - TLS Handshake: Look for
16 03 01at the start of packets. This is the "Client Hello" signature of a TLS secured connection. - No Plaintext: You should NOT see any website names (like
google.com) or HTML content in the data dump.