github-hosts
GitHub 访问加速,解决 GitHub 访问慢的问题。
使用 Cloudflare Workers 和公共 DNS API 来获取 IP 地址。
GitHub 地址:github.com/TinsFox/git…
特性
- 🚀 使用 Cloudflare Workers 部署,无需服务器
- 🌍 多 DNS 服务支持(Cloudflare DNS、Google DNS)
- ⚡️ 每 60 分钟自动更新 DNS 记录
- 💾 使用 Cloudflare KV 存储数据
- 🔄 提供多种使用方式(脚本、手动、工具)
- 📡 提供 REST API 接口
使用方法
1. 命令行工具(推荐)
MacOS 用户
sudo curl -fsSL https://github.com/TinsFox/github-hosts/releases/download/v0.0.1/github-hosts.darwin-arm64 -o github-hosts && sudo chmod +x ./github-hosts && ./github-hosts
Windows 与 Linux 的脚本还没有经过测试,遇到问题请提 issue
Windows 用户
在管理员权限的 PowerShell 中执行:
irm https://github.com/TinsFox/github-hosts/releases/download/v0.0.1/github-hosts.windows-amd64.exe | iex
Linux 用户
sudo curl -fsSL https://github.com/TinsFox/github-hosts/releases/download/v0.0.1/github-hosts.linux-amd64 -o github-hosts && sudo chmod +x ./github-hosts && ./github-hosts
更多版本请查看 Release 页面
2. SwitchHosts 工具
- 下载 SwitchHosts
- 添加规则:
- 方案名:GitHub Hosts
- 类型:远程
- URL:
https://github-hosts.tinsfox.com/hosts - 自动更新:1 小时
3. 手动更新
- 获取 hosts:访问 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:
API 文档
GET /hosts- 获取 hosts 文件内容GET /hosts.json- 获取 JSON 格式的数据GET /{domain}- 获取指定域名的实时 DNS 解析结果POST /reset- 清空缓存并重新获取所有数据(需要 API 密钥)