Skip to content

Instantly share code, notes, and snippets.

@jyxjjj
Created September 15, 2025 06:41
Show Gist options
  • Save jyxjjj/42330f48b3fc853c1ec0293be1ccdc35 to your computer and use it in GitHub Desktop.
Save jyxjjj/42330f48b3fc853c1ec0293be1ccdc35 to your computer and use it in GitHub Desktop.
#!/bin/zsh
export API_DOMAIN
export API_URL
export PARAMS
/opt/homebrew/bin/curl \
--interface $(
if ifconfig en0 2>/dev/null | grep -q 'status: active'; then
echo 'en0'
elif ifconfig en15 2>/dev/null | grep -q 'status: active'; then
echo 'en15'
else
echo 'en0'
fi
) \
--resolve $API_DOMAIN:443:$(/opt/homebrew/bin/dig +https @223.5.5.5 $API_DOMAIN +short | tail -n1) \
-fSsL -4 --connect-timeout 10 --retry-delay 1 --retry 30 \
-X POST $API_URL --data-raw $PARAMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment