- 🚀 使用 Cloudflare Workers 部署,无需服务器
- 🌍 多 DNS 服务支持(Cloudflare DNS、Google DNS)
- ⚡️ 每 60 分钟自动更新 DNS 记录
- 💾 使用 Cloudflare KV 存储数据
- 🔄 提供多种使用方式(脚本、手动、工具)
- 📡 提供 REST API 接口
在管理员权限的 PowerShell 中执行:
irm https://cdn.jsdelivr.net/gh/TinsFox/github-hosts@v1.0.6/github-hosts.windows-amd64.exe | iex# Apple Silicon (ARM64)
sudo curl -fsSL https://cdn.jsdelivr.net/gh/TinsFox/github-hosts@v1.0.6/github-hosts.darwin-arm64 -o /usr/local/bin/github-hosts && sudo chmod +x /usr/local/bin/github-hosts && github-hosts# AMD64 架构
sudo curl -fsSL https://cdn.jsdelivr.net/gh/TinsFox/github-hosts@v1.0.6/github-hosts.linux-amd64 -o /usr/local/bin/github-hosts && sudo chmod +x /usr/local/bin/github-hosts && github-hosts📝 更多架构版本请查看下载说明
- 下载 SwitchHosts
- 添加规则:
- 方案名:GitHub Hosts
- 类型:远程
- URL:
https://github-hosts.tinsfox.com/hosts - 自动更新:1 小时
- 获取 hosts:访问 https://github-hosts.tinsfox.com/hosts
- 更新本地 hosts 文件:
- Windows:
C:\Windows\System32\drivers\etc\hosts - MacOS/Linux:
/etc/hosts
- Windows:
- 刷新 DNS:
- Windows:
ipconfig /flushdns - MacOS:
sudo killall -HUP mDNSResponder - Linux:
sudo systemd-resolve --flush-caches
- Windows:
从 Release 页面 下载:
GET /hosts- 获取 hosts 文件内容GET /hosts.json- 获取 JSON 格式的数据GET /{domain}- 获取指定域名的实时 DNS 解析结果POST /reset- 清空缓存并重新获取所有数据(需要 API 密钥)
- Windows:需要以管理员身份运行
- MacOS/Linux:需要 sudo 权限
- Windows:检查任务计划程序中的 "GitHub Hosts Updater"
- MacOS/Linux:使用
crontab -l检查
- 检查日志:
~/.github-hosts/logs/update.log - 确保网络连接和文件权限正常
- Fork 本项目
- 创建 Cloudflare Workers 账号
- 安装并部署:
npm install
npm run dev # 本地开发
npm run deploy # 部署到 Cloudflare