#!/usr/bin/env sh
# Connectivity check for Google (gcr.io / Artifact Registry) - run from inside the restricted network.
# Generated by pullist on 2026-06-12. Needs: curl.
# Any HTTP status counts as reachable; we only test that TCP/TLS gets through.
# Fail fast if curl is not available
if ! command -v curl >/dev/null 2>&1; then
  echo "FAIL  curl is not installed or not in PATH"
  exit 127
fi
fail=0
check() {
  code=$(curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 5 "https://$1/" 2>/dev/null)
  rc=$?
  if [ "$rc" -eq 0 ] || [ "$code" != "000" ]; then
    printf "OK    %s\n" "$1"
  else
    printf "FAIL  %s  (curl exit %s: 6=dns 7=refused 28=timeout 35=tls)\n" "$1" "$rc"
    fail=1
  fi
}
check gcr.io
check us.gcr.io # representative host for *.gcr.io
check us-docker.pkg.dev # representative host for *.pkg.dev
check storage.googleapis.com
check oauth2.googleapis.com
exit $fail
