dyn_dns
This commit is contained in:
@@ -49,11 +49,13 @@ let dns-user = "cloudflare"; in
|
||||
} /* python */ ''
|
||||
import requests
|
||||
import subprocess
|
||||
from time import sleep
|
||||
|
||||
def get_public_ip(ipv6: bool = False) -> str:
|
||||
return subprocess.run(['${pkgs.curl}/bin/curl', '-s', '-6' if ipv6 else '-4', 'https://ifconfig.me'], capture_output=True, text=True).stdout.strip()
|
||||
|
||||
def update_record(record_id: str, record_name: str, ip: str, type: str, proxied: bool, pw: str) -> None:
|
||||
sleep(5)
|
||||
return requests.patch(
|
||||
f'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/{record_id}',
|
||||
headers={
|
||||
|
||||
Reference in New Issue
Block a user