#!/bin/bash # Enhanced IPv6 Website Testing Script echo "๐ŸŒ Mycelium IPv6 Website Testing" echo "=================================" # Get IPv6 addresses from nodes echo "๐Ÿ” Discovering IPv6 addresses..." IPV6_ADDRS=$(kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.annotations.k3s\.io/internal-ip}{"\n"}{end}' | tr ',' '\n' | grep ':' | sort | uniq) if [ -z "$IPV6_ADDRS" ]; then echo "โŒ No IPv6 addresses found!" exit 1 fi echo "โœ… Found IPv6 addresses:" echo "$IPV6_ADDRS" | nl # Get current pod info POD_INFO=$(kubectl get pods -l app=mycelium-website -o wide --no-headers) echo "" echo "๐Ÿ“Š Current Deployment Status:" echo "$POD_INFO" # Test each IPv6 address echo "" echo "๐Ÿงช Testing IPv6 connectivity..." SUCCESS_COUNT=0 TOTAL_COUNT=$(echo "$IPV6_ADDRS" | wc -l) for IPV6 in $IPV6_ADDRS; do echo "" echo "Testing: http://[$IPV6]:8080" # Test connection with timeout and show result if timeout 5 curl -6 -s --connect-timeout 3 --max-time 8 "http://[$IPV6]:8080" > /tmp/test_response.txt 2>/dev/null; then if [ -s /tmp/test_response.txt ]; then echo "โœ… SUCCESS - Website accessible!" SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) # Show content preview echo "๐Ÿ“„ Content preview:" head -5 /tmp/test_response.txt | sed 's/^/ /' echo " ..." else echo "โš ๏ธ Connection succeeded but no content received" fi else echo "โŒ FAILED - Cannot connect" fi done echo "" echo "๐Ÿ“Š Results Summary:" echo " Total IPv6 addresses: $TOTAL_COUNT" echo " Accessible websites: $SUCCESS_COUNT" echo " Success rate: $(( SUCCESS_COUNT * 100 / TOTAL_COUNT ))%" if [ $SUCCESS_COUNT -gt 0 ]; then echo "" echo "๐ŸŽฏ Working URLs:" for IPV6 in $IPV6_ADDRS; do if timeout 3 curl -6 -s --connect-timeout 2 "http://[$IPV6]:8080" > /dev/null 2>/dev/null; then echo " http://[$IPV6]:8080 โœ…" fi done echo "" echo "๐Ÿš€ Your website is globally accessible via Mycelium IPv6!" echo " Users worldwide can now visit your site using these URLs." else echo "" echo "๐Ÿ”ง Troubleshooting Tips:" echo " - Check if Mycelium service is running on nodes" echo " - Verify firewall rules allow IPv6 traffic on port 8080" echo " - Ensure nginx is actually listening (check pod logs)" fi # Cleanup rm -f /tmp/test_response.txt