Projets
Voir sur GitHub
TinsFox/github-hosts
À propos
GitHub 访问加速,解决 GitHub 访问慢的问题。使用 Cloudflare Workers 和公共 DNS API 来获取 IP 地址。
Systèmes et infrastructureProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Originalgithub-hosts
⚠️ 服务已临时下线 - 因接口被刷,KV 配额已耗尽,恢复时间待定。
特性
- 🚀 使用 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 用户
在管理员权限的 PowerShell 中执行:
Invoke-WebRequest "https://github.com/TinsFox/github-hosts/releases/download/v0.0.1/github-hosts.windows-amd64.exe" -OutFile "$env:USERPROFILE\gh.exe"; & "$env:USERPROFILE\gh.exe"
[!IMPORTANT] Linux 的脚本还没有经过测试,遇到问题请提 issue
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:访问 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:
API 文档
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 账号
- 安装并部署:
pnpm install
pnpm run dev # 本地开发
pnpm run deploy # 部署到 Cloudflare
鸣谢
许可证
Explorer des projets similaires
Chargement…
