Logo of wyzie-docsWyzie Docs

i6.shark

Hosting i6.shark#

Setting up i6.shark requires a VPS with a /48 IPv6 subnet. Once configured, it runs autonomously with minimal maintenance.

Steps#

Clone the repository to /opt/i6.shark:
sudo git clone https://github.com/wyziedevs/i6.shark.git /opt/i6.shark
cd /opt/i6.shark
Configure constants in src/consts.go:
sudo nano /opt/i6.shark/src/consts.go
Update IPv6Prefix and Interface to match your server. The shared secret goes in the environment (next step), not in this file; SharedSecret is only a fallback when I6_SHARED_SECRET is unset. The remaining tuning constants have sensible defaults and typically don't need changes.
const (
  SharedSecret = ""                         // Fallback only: set I6_SHARED_SECRET instead
  Version      = "3.1"                      // Version of the script
  IPv6Prefix   = "xxxx:xxxx:xxxx"            // Your /48 prefix
  IPv6Subnet   = "6000"                      // Subnet within your /48
  Interface    = "ens3"                       // Network interface
  ListenPort   = 80                           // Proxy server port
  ListenHost   = "0.0.0.0"                    // Listen on all interfaces
  Debug        = false                        // Enable debug output
)
Put the shared secret in a root-only environment file. Use the same value in your client (for Wyzie Subs, I6_PROXY_SECRET):
sudo install -m 600 /dev/null /etc/i6shark.env
echo "I6_SHARED_SECRET=$(openssl rand -hex 32)" | sudo tee /etc/i6shark.env >/dev/null
Build the application:
cd /opt/i6.shark
sudo go build -o i6shark ./src
Create the systemd service:
sudo tee /etc/systemd/system/i6shark.service >/dev/null <<'EOF'
[Unit]
Description=i6.shark IPv6 proxy
After=network-online.target
Wants=network-online.target
 
[Service]
WorkingDirectory=/opt/i6.shark
EnvironmentFile=/etc/i6shark.env
ExecStart=/opt/i6.shark/i6shark
Restart=always
RestartSec=3
User=root
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_ADMIN
 
[Install]
WantedBy=multi-user.target
EOF
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable --now i6shark
Check the status:
sudo systemctl status i6shark

The proxy server will now run automatically on boot and restart itself if it crashes.

Daily Restart (Optional)#

Add a cron job to restart the server daily at a random time:

(sudo crontab -l 2>/dev/null; echo "$(shuf -i 0-59 -n 1) $(shuf -i 0-23 -n 1) * * * systemctl restart i6shark") | sudo crontab -

API Authentication#

API tokens are generated using HMAC-SHA256 with the shared secret (I6_SHARED_SECRET) over the user-agent header, and sent in the API-Token header, which the proxy never forwards upstream. See the validateAPIToken function in the source code for implementation details. If a secret ever leaks, set a new one and restart the service.