{"id":34559787,"url":"https://github.com/2ue/fast-github-hosts","last_synced_at":"2026-06-12T04:01:53.231Z","repository":{"id":325408650,"uuid":"1101051022","full_name":"2ue/fast-github-hosts","owner":"2ue","description":"Automatic GitHub Hosts generator with DoH, TCP speed test, and smart caching. Updates every 2 hours via GitHub Actions.","archived":false,"fork":false,"pushed_at":"2026-06-08T02:56:09.000Z","size":2110,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-08T04:24:30.831Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2ue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T05:56:19.000Z","updated_at":"2026-06-08T02:56:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"bee0fd58-9aba-43cc-9f31-ba521f534de3","html_url":"https://github.com/2ue/fast-github-hosts","commit_stats":null,"previous_names":["2ue/fast-github-hosts"],"tags_count":769,"template":false,"template_full_name":null,"purl":"pkg:github/2ue/fast-github-hosts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Ffast-github-hosts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Ffast-github-hosts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Ffast-github-hosts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Ffast-github-hosts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2ue","download_url":"https://codeload.github.com/2ue/fast-github-hosts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Ffast-github-hosts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34228097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T08:52:02.327Z","updated_at":"2026-06-12T04:01:53.214Z","avatar_url":"https://github.com/2ue.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Hosts 自动生成工具\n\n\u003e 自动获取GitHub所有域名的最优IP，生成hosts文件，加速GitHub访问\n\u003e\n\u003e 方法：多DNS源查询 + Ping+TCP测速\n\n---\n\n## ✨ 特性\n\n- 🚀 **自动DNS查询**：并发查询4个DNS服务器（Cloudflare、Google、阿里、114）\n- ⚡ **智能测速**：Ping + TCP双重测速，综合评分选择最快IP\n- 📋 **完整域名**：涵盖49个核心GitHub域名（可扩展至120+）\n- 🔄 **并发处理**：多线程并发，快速生成\n- 📊 **详细输出**：实时显示处理进度和测速结果\n\n---\n\n## 📦 安装依赖\n\n```bash\npip install dnspython\n```\n\n---\n\n## 🚀 快速使用\n\n### 1. 生成hosts文件\n\n```bash\npython3 generate_github_hosts.py\n```\n\n### 2. 应用hosts文件\n\n#### Linux/Mac\n\n```bash\n# 备份原hosts\nsudo cp /etc/hosts /etc/hosts.bak\n\n# 应用新hosts\nsudo cp ultra_hosts /etc/hosts\n\n# 刷新DNS\nsudo systemd-resolve --flush-caches  # Linux\nsudo killall -HUP mDNSResponder      # Mac\n```\n\n#### Windows\n\n```powershell\n# 以管理员身份运行PowerShell\n\n# 备份原hosts\ncopy C:\\Windows\\System32\\drivers\\etc\\hosts C:\\Windows\\System32\\drivers\\etc\\hosts.bak\n\n# 应用新hosts（手动复制ultra_hosts内容到hosts文件）\n\n# 刷新DNS\nipconfig /flushdns\n```\n\n---\n\n## 📋 域名列表\n\n脚本包含 **141个完整域名**，涵盖：\n\n| 分类 | 数量 | 说明 |\n|------|------|------|\n| 核心服务 | 12 | github.com、api.github.com等 |\n| CDN静态资源 | 5 | github.githubassets.com等 |\n| UserContent | 21 | raw.githubusercontent.com、objects等 |\n| 包管理器 | 12 | ghcr.io、npm、docker、pypi等 |\n| AWS S3存储 | 5 | github-cloud.s3.amazonaws.com等 |\n| Copilot | 6 | githubcopilot.com、api等 |\n| Actions核心 | 9 | pipelines、vstoken、broker等 |\n| Actions Pipelines | 28 | pipelinesghubeus系列 |\n| Actions Runners | 12 | runnerghubeus系列 |\n| Azure Blob - Actions | 20 | productionresultssa系列 |\n| Azure Blob - 包管理 | 4 | maven/npm/nuget/rubygems blob |\n| 安全认证 | 3 | tuf-repo、fulcio等 |\n| 开发工具 | 1 | vscode.dev |\n| **总计** | **141** | **完整覆盖所有GitHub服务** |\n\n详细域名列表请查看 [DOMAINS.md](./DOMAINS.md)\n\n---\n\n## ⚙️ 配置说明\n\n编辑 `generate_github_hosts.py` 可自定义配置：\n\n```python\n# DNS服务器列表\nDNS_SERVERS = [\n    '1.1.1.1',          # Cloudflare\n    '8.8.8.8',          # Google\n    '223.5.5.5',        # 阿里\n    '114.114.114.114',  # 114\n]\n\n# 测速配置\nPING_COUNT = 2          # Ping次数\nTCP_TIMEOUT = 2         # TCP超时（秒）\nTCP_PORT = 443          # 测试端口\nMAX_WORKERS = 10        # 最大并发数\n```\n\n---\n\n## 📊 运行示例\n\n```\n======================================================================\n🚀 GitHub Hosts 自动生成工具 - Ultra版本\n======================================================================\n📋 域名总数: 141\n🌐 DNS服务器: 1.1.1.1, 8.8.8.8, 223.5.5.5, 114.114.114.114\n⚡ 测速方法: Ping + TCP\n======================================================================\n\n🔍 正在处理: github.com\n  📡 找到 3 个IP: 20.205.243.166, 140.82.114.4, 140.82.113.3\n  ⚡ 20.205.243.166: 45.32ms\n  ⚡ 140.82.114.4: 156.78ms\n  ⚡ 140.82.113.3: 158.92ms\n  ✅ 最快IP: 20.205.243.166 (45.32ms)\n\n🔍 正在处理: api.github.com\n  📡 找到 2 个IP: 20.205.243.168, 140.82.113.5\n  ⚡ 20.205.243.168: 43.21ms\n  ⚡ 140.82.113.5: 157.45ms\n  ✅ 最快IP: 20.205.243.168 (43.21ms)\n\n...\n\n======================================================================\n✅ Hosts文件已生成: ultra_hosts\n✅ 成功获取: 141/141 个域名\n⏱️  总耗时: 120.45 秒\n======================================================================\n```\n\n---\n\n## 🎯 高级用法\n\n### 扩展域名列表\n\n如果你需要更多域名（如完整的Actions支持），编辑 `GITHUB_DOMAINS` 列表：\n\n```python\nGITHUB_DOMAINS = [\n    # ... 原有域名 ...\n\n    # 添加Actions额外域名\n    'vstoken.actions.githubusercontent.com',\n    'broker.actions.githubusercontent.com',\n    'launch.actions.githubusercontent.com',\n    # ... 更多域名见DOMAINS.md ...\n]\n```\n\n### 定时自动更新\n\nLinux/Mac使用crontab定时执行：\n\n```bash\n# 每天凌晨3点自动更新\n0 3 * * * cd /path/to/github-hosts \u0026\u0026 python3 generate_github_hosts.py \u0026\u0026 sudo cp ultra_hosts /etc/hosts \u0026\u0026 sudo systemd-resolve --flush-caches\n```\n\n---\n\n## 🔧 故障排除\n\n### DNS查询失败\n\n- **原因**：DNS服务器被墙或超时\n- **解决**：更换DNS服务器，或增加超时时间\n\n### 测速失败\n\n- **原因**：防火墙阻止ICMP或TCP连接\n- **解决**：\n  - 临时关闭防火墙测试\n  - 调整TCP端口（默认443）\n  - 增加超时时间\n\n### 所有IP都很慢\n\n- **原因**：你的网络到GitHub服务器延迟较高\n- **解决**：\n  - 尝试不同时间段运行\n  - 考虑使用代理或VPN\n  - 检查本地网络质量\n\n---\n\n## 📝 文件说明\n\n```\ngithub-hosts/\n├── generate_github_hosts.py    # 主脚本\n├── DOMAINS.md                   # 完整域名列表文档\n├── README.md                    # 使用说明\n└── ultra_hosts                  # 生成的hosts文件（运行后）\n```\n\n---\n\n## 🤝 贡献\n\n欢迎提交Issue和PR！\n\n---\n\n## 📄 许可证\n\nMIT License\n\n---\n\n## ⚠️ 免责声明\n\n本工具仅用于加速GitHub访问，不保证100%成功。使用本工具修改hosts文件造成的任何问题，作者不承担责任。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2ue%2Ffast-github-hosts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2ue%2Ffast-github-hosts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2ue%2Ffast-github-hosts/lists"}