WarmCache 是一个针对中国大陆主要运营商节点的 CDN 预热工具。它会通过 DoH(HTTPS) 查询遍布全国各地的递归 DNS,收集实际缓存节点 IP,然后对给定资源执行并发预热和命中校验,帮助你在正式流量到来前抢先把内容塞进 CDN 边缘缓存。
| 类型标注和 asyncio.run)aiohttp(pip install -r requirements.txt)pip install -r requirements.txt python main.py --url https://example.com/{1..100}.txt
默认会以 HTTPS DoH 解析 A 记录,并在预热阶段对每个节点执行 3 次带随机延迟的请求。
--url https://example.com/1.txt--url https://example.com/{1..100}.txt
{001..050}。| 参数 | 默认值 | 说明 |
|---|---|---|
--url | 必填 | 待预热的资源 URL 或范围。 |
--doh | https://doh.pub/dns-query | DoH(JSON) 端点,可替换为自定义解析服务。 |
--type | A | 解析类型,支持 A / AAAA。 |
--pool-size | 30 | DNS 与预热共享的并发连接数。 |
--dns-timeout | 3.0 | 单次 DoH 请求超时(秒)。 |
--dns-retries | 2 | DoH 重试次数。 |
--attempts | 3 | 每个节点重复请求次数。 |
--req-timeout | 1.0 | 单次预热请求超时时长(秒)。 |
--budget | 10.0 | 单节点总耗时预算,超出即停止尝试。 |
--insecure | 开启 | HTTPS 直连 IP 时跳过证书校验。 |
--strict-cert | 关闭 | 若需要严格验证证书,可加此参数关闭 --insecure。 |
查看完整参数列表:
python main.py --help
eo-cache-status(或 eo_cache_status)判定是否命中。--insecure 跳过校验,如需验证请加 --strict-cert。