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 SharedSecret, IPv6Prefix, and Interface to match your server:

const (
  SharedSecret = "your-shared-secret-here"  // Secret between client & server
  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
)

The remaining tuning constants (pool sizes, timeouts, concurrency limits) have sensible defaults and typically don't need changes.

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
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 a shared secret key. The input for key generation is the user-agent header. See the validateAPIToken function in the source code for implementation details.