Improve LAN detection: check Headscale port response, not just ping
Ping 192.168.0.100 can false-positive if external pharmacy has a device at that IP. Now checks if 192.168.0.100:8070 actually responds like Headscale. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -171,11 +171,14 @@ phase2_tailscale_pve() {
|
||||
print_phase "Phase 2/8: PVE Host Tailscale 등록"
|
||||
|
||||
# Headscale 서버 주소 자동 감지 (LAN vs 외부)
|
||||
# ping만으로는 부정확 (외부 약국에 192.168.0.100 장비가 있을 수 있음)
|
||||
# → Headscale 8070 포트에 실제 응답하는지 확인
|
||||
if [ -z "$HEADSCALE_SERVER" ]; then
|
||||
print_step "Headscale 서버 접근 경로 감지 중..."
|
||||
if ping -c1 -W2 192.168.0.100 >/dev/null 2>&1; then
|
||||
if curl -s --connect-timeout 3 http://192.168.0.100:8070/health 2>/dev/null | grep -qi "ok\|healthy" || \
|
||||
curl -s --connect-timeout 3 -o /dev/null -w "%{http_code}" http://192.168.0.100:8070/ 2>/dev/null | grep -q "200\|404"; then
|
||||
HEADSCALE_SERVER="$HEADSCALE_SERVER_LAN"
|
||||
print_ok "LAN 감지 → 직접 연결 ($HEADSCALE_SERVER)"
|
||||
print_ok "LAN Headscale 감지 → 직접 연결 ($HEADSCALE_SERVER)"
|
||||
else
|
||||
HEADSCALE_SERVER="$HEADSCALE_SERVER_EXT"
|
||||
print_ok "외부 네트워크 → 도메인 경유 ($HEADSCALE_SERVER)"
|
||||
|
||||
Reference in New Issue
Block a user