#!/usr/bin/env bash

set -e

echo "==============================="
echo "  Steam Deck Network Checker"
echo "==============================="

# Public IP
echo ""
echo "[+] Checking Public (WAN) IP..."
PUBLIC_IP=$(curl -4 -s https://ipecho.net/plain || true)

if [[ -z "$PUBLIC_IP" ]]; then
  echo "[!] Could not retrieve WAN IP. Try a browser: https://icanhazip.com"
else
  echo "Public Internet IP:"
  echo ">>> $PUBLIC_IP <<<"
fi

# Local IP (in case you're same LAN)
echo ""
echo "[+] Local Network IP:"
hostname -I 2>/dev/null || echo "Not available"

echo ""
echo "==============================="
echo "Tell your brother:"
echo "SEND ME THE PUBLIC IP ABOVE."
echo "Do not continue until he confirms the firewall is open."
echo "==============================="
echo ""
read -p "Press ENTER ONLY AFTER he tells you it's ready... " TMP

echo ""
echo "Cool. Ready when you are ✌️"
echo "(You can run the speed script now if provided.)"
