一晚好梦 (@hello_world1024)分享个获取站点最优cdn并写入hosts的脚本 中发帖

需求介绍:在Linux环境下使用nslookup名获取pt站点最优cf cdn ipv4、ipv6地址并写入hosts,以达到最快访问的目的 
开发团队:deepseek v3 0324
import subprocess
import socket
import time
import shutil
import sys
import logging
from concurrent.futures import ThreadPoolExecutor
from typing import List, Dict, Tuple, Optional

# 配置参数
DOMAINS = ["example.com", "example.org"] # 多域名配置
DNS_SERVER = "223.6.6.6" # 使用阿里云DNS
HOSTS_PATH = "...