heiher / natmap

TCP/UDP port mapping for full cone NAT
MIT License
1.38k stars 103 forks source link

ddns via cloudflare #58

Closed linnuxx closed 6 months ago

linnuxx commented 7 months ago

!/bin/sh

ZONE='' RECORD='' EMAIL='' AUTH='' DOMAIN=''

IP4P=${3}

while true; do curl -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONE}/dns_records/${RECORD}" \ -H "X-Auth-Email: ${EMAIL}" \ -H "Authorization: Bearer ${AUTH}" \ -H "Content-Type:application/json" \ --data "{\"type\":\"AAAA\",\"name\":\"${DOMAIN}\",\"content\":\"${IP4P}\",\"ttl\":60,\"proxied\":false}" > /dev/null 2> /dev/null if [ $? -eq 0 ]; then break fi done

where to get these variables: ZONE=" RECORD=" EMAIL=" AUTH=" DOMAIN="

heiher commented 7 months ago

refer to https://developers.cloudflare.com/api/