rego-tunnel: use VM_NET_IP env var directly instead of detecting
Some checks failed
Test / test (push) Has been cancelled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-19 09:10:38 +00:00
parent 971a888fea
commit 2fe54fc7f0

View File

@@ -15,16 +15,12 @@ cp /vpn_scripts/id_ed25519-lenovo /root/.ssh/ 2>/dev/null || true
chmod 600 /root/.ssh/id_ed25519-lenovo 2>/dev/null || true
get_windows_ip() {
# Method 1: DHCP leases (hostname is "Windows")
local ip=$(awk '/Windows/ {print $3}' /var/lib/misc/dnsmasq.leases 2>/dev/null | head -1)
if [[ -n "$ip" ]]; then echo "$ip"; return; fi
# Method 2: ip neigh (ARP table) - look for 172.32.x.x on docker interface (VM_NET_IP subnet)
ip=$(ip neigh show dev docker 2>/dev/null | grep -oE '172\.32\.[0-9]+\.[0-9]+' | head -1)
if [[ -n "$ip" ]]; then echo "$ip"; return; fi
# Method 3: qemu.ip file (if available)
cat /run/shm/qemu.ip 2>/dev/null || true
# Use VM_NET_IP env var if set, otherwise detect from DHCP leases
if [[ -n "${VM_NET_IP:-}" ]]; then
echo "$VM_NET_IP"
return
fi
awk '/Windows/ {print $3}' /var/lib/misc/dnsmasq.leases 2>/dev/null | head -1
}
get_container_ip() {