Maintaining a 24/7 VPN connection is essential for Lightning Node operations. This guide provides scripts to automate the monitoring and recovery of your TunnelSats tunnel.
TunnelSats nodes may occasionally migrate IPs for maintenance. If your handshake fails for more than 5 minutes, our internal logic likely updated the DNS.
If your tunnel is down, don't just restart WireGuard. Instead, call the Sync API to get fresh data from the VPN server, or the Status API to check by WireGuard key.
The VPN server does not throttle. When a key uses up its 100 GB monthly allowance, its peer is disabled; a paid reset sets the usage counter back to 0 and re-enables it. The API accepts a reset at any usage, so decide in your client when one is worth it. A common policy is to request a reset only at high usage, as this script does.
Apply your own reset policy
Always apply your own usage policy before paying. Don't rely on the API to reject resets you don't need.
WireGuard Claim: Always offer a way to "Claim" the config again if the initial download fails.
Self-Healing: If wg show indicates no handshake for >3 minutes, automatically call /sync (authenticated) or /status (by key) to verify the server hasn't migrated.
Bandwidth Monitoring: Periodically check /status and warn users when bandwidth_used_gb reaches 70% of bandwidth_limit_gb. Before offering a reset, show the usage it gives back and bandwidth_resets_this_month / max_resets_per_month.
Custom Keys
We recommend generating keys on our server (leaving wgPublicKey empty) for the easiest setup. However, for maximum privacy, allow advanced users to provide their own wgPublicKey.