Hello World

吞风吻雨葬落日 欺山赶海踏雪径

0%

免费域名注册

申请www.cloudns.net免费域名并,托管cloudflare教程

首先去cloudns注册账号,可以选择免费域名(大陆ip可能被拦截),
注册成功之后使用cloudflare托管,这里直接按cloudflare的引导做就可以了(设置NS记录)。

因为是免费的,域名可能会绑定了多个DNS, 我申请的就绑定了700+跳记录,手动删除是不可能的。这里可以使用cloudflare的api执行批量删除。

首先在My Profile -> API Tokens -> Create Token, 注意,这里的Zone选择DNS,权限需要选择Edit,
随后Include Specific zone选择对应的域名点击保存即可。
20240101000001.png
得到 Token 之后 更具对应的zone(url上有)替换下面脚本变量执行即可批量删除。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
import time

API_TOKEN = "[token]"
ZONE_ID = "[zone_id]"

baseUrl = f"https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/dns_records"

proxies = {
"http": "socks5://127.0.0.1:7890",
"https": "socks5://127.0.0.1:7890",
}

timeout = 10
headers = {
'Authorization': f'Bearer {API_TOKEN}',
'Content-Type': 'application/json'
}

listUrl = f"{baseUrl}?per_page=800"
print(listUrl)
response = requests.get(listUrl, headers=headers, timeout=timeout, proxies=proxies)
records = response.json()['result']

for record in records:
name = record['name']
content = record['content']

print(f"Deleting {name} that points to {content}")

deleteUrl = f"{baseUrl}/{record['id']}"
rsp = requests.delete(deleteUrl, headers=headers, timeout=timeout, proxies=proxies)
print(rsp.json()['success'])
time.sleep(1)

注意上面使用了代理,速度会快很多,不需要删除proxies相关内容即可。