{"id":15126197,"url":"https://github.com/licoy/fetch-github-hosts","last_synced_at":"2026-02-14T05:10:42.672Z","repository":{"id":37448824,"uuid":"491782606","full_name":"Licoy/fetch-github-hosts","owner":"Licoy","description":"🌏 同步github的hosts工具，支持多平台的图形化和命令行，内置客户端和服务端两种模式~ | Synchronize GitHub hosts tool, support multi-platform graphical and command line, built-in client and server modes","archived":false,"fork":false,"pushed_at":"2025-02-25T08:42:35.000Z","size":525,"stargazers_count":1257,"open_issues_count":5,"forks_count":127,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-04-08T15:00:36.798Z","etag":null,"topics":["github","github-hosts","hosts","hosts-tool","sync-hosts"],"latest_commit_sha":null,"homepage":"https://hosts.gitcdn.top","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Licoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-05-13T06:28:04.000Z","updated_at":"2025-04-07T01:13:09.000Z","dependencies_parsed_at":"2024-01-06T06:42:22.135Z","dependency_job_id":"2175945d-ace6-4565-aebe-c3d615572193","html_url":"https://github.com/Licoy/fetch-github-hosts","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Ffetch-github-hosts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Ffetch-github-hosts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Ffetch-github-hosts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Ffetch-github-hosts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Licoy","download_url":"https://codeload.github.com/Licoy/fetch-github-hosts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254219374,"owners_count":22034397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["github","github-hosts","hosts","hosts-tool","sync-hosts"],"created_at":"2024-09-26T02:02:38.584Z","updated_at":"2026-02-14T05:10:42.667Z","avatar_url":"https://github.com/Licoy.png","language":"Go","readme":"简体中文 | [English](./README_EN.md) | [日本語](./README_JA.md)\n\n\u003cdiv align=\"center\"\u003e\n\u003ch2\u003eFetch GitHub Hosts\u003c/h2\u003e\n\n\u003cimg src=\"public/logo.png\" width=\"128\" height=\"128\" alt=\"Logo\"\u003e\n\n`fetch-github-hosts` 是主要为解决研究及学习人员访问 `Github` 过慢或其他问题而提供的 `Github Hosts` 同步工具\n\n[![Release](https://img.shields.io/github/v/release/Licoy/fetch-github-hosts.svg?logo=git)](https://github.com/Licoy/fetch-github-hosts/releases)\n[![GitHub Stars](https://img.shields.io/github/stars/Licoy/fetch-github-hosts?style=flat\u0026logo=github)](https://github.com/Licoy/fetch-github-hosts)\n[![License](https://img.shields.io/github/license/Licoy/fetch-github-hosts)](./LICENSE)\n\n\u003c/div\u003e\n\n## ✨ 特性\n\n- 🖥️ **跨平台桌面客户端** — 支持 macOS (Intel \u0026 Apple Silicon)、Windows、Linux\n- 🔄 **客户端模式** — 从远程源自动同步 Hosts 到系统\n- 🌐 **服务端模式** — 自建 DNS 解析服务，提供 HTTP API 供其他设备使用\n- 🌓 **深色/浅色/跟随系统** 三种主题模式\n- 🌍 **多语言支持** — 简体中文、English、日本語\n- 🔒 **智能提权** — 首次写入 Hosts 时一次性授权，会话期间无需重复输入密码\n- 📡 **系统托盘** — 后台运行，一键启停\n\n## 📦 安装\n\n前往 [Releases](https://github.com/Licoy/fetch-github-hosts/releases) 下载对应平台安装包：\n\n| 平台 | 文件类型 | 架构 |\n|------|---------|------|\n| macOS | `.dmg` | Universal (Intel + Apple Silicon) |\n| Windows | `.msi` / `.exe` | x86_64 |\n| Linux | `.deb` / `.AppImage` | x86_64 |\n\n## 🚀 使用方法\n\n### 桌面客户端\n\n下载安装后直接运行即可，提供图形化界面操作。\n\n#### 客户端模式\n\n从远程 Hosts 源获取最新的 GitHub 相关 DNS 记录，自动写入系统 hosts 文件。\n\n- 支持多种 Hosts 源（FetchGithubHosts、Github520）\n- 支持自定义远程 URL\n- 可设置自动获取间隔（分钟）\n\n#### 服务端模式\n\n在本地启动 HTTP 服务，自动解析 GitHub 域名并提供 hosts 文件下载。\n\n- 默认监听端口 `9898`\n- 提供 `hosts.txt`（纯文本）和 `hosts.json`（JSON）两种格式\n- 内置美观的 Web 页面，支持深色/浅色主题和多语言\n\n### 命令行终端\n\n到 [Releases](https://github.com/Licoy/fetch-github-hosts/releases) 中下载您的系统版本，可以直接通过命令行使用。\n\n#### 参数\n\n| 参数名 | 缩写 | 默认值 | 描述 |\n|--------|------|--------|------|\n| `--mode` | `-m` | 无（启动 GUI） | 启动模式：`client`（客户端）/ `server`（服务端） |\n| `--interval` | `-i` | `60` | 获取 hosts 的间隔时间（分钟） |\n| `--port` | `-p` | `9898` | 服务端模式监听端口 |\n| `--url` | `-u` | `https://hosts.gitcdn.top/hosts.txt` | 客户端模式远程 hosts 获取链接 |\n| `--lang` | `-l` | 自动检测 | 界面语言（`zh-CN`、`en-US`、`ja-JP`） |\n\n#### 启动客户端\n\n```bash\n# Linux/macOS\nsudo ./fetch-github-hosts -m client\n\n# Windows\nfetch-github-hosts.exe -m client\n\n# 自定义获取间隔（10分钟）\nsudo ./fetch-github-hosts -m client -i 10\n\n# 自定义获取链接\nsudo ./fetch-github-hosts -m client -u http://127.0.0.1:9898/hosts.json\n```\n\n#### 启动服务端\n\n```bash\n# Linux/macOS\n./fetch-github-hosts -m server\n\n# Windows\nfetch-github-hosts.exe -m server\n\n# 自定义端口\n./fetch-github-hosts -m server -p 6666\n```\n\n\u003e 💡 不指定 `-m` 参数时将启动图形化界面\n\n### 手动方式\n\n#### 添加 Hosts\n\n访问 [https://hosts.gitcdn.top/hosts.txt](https://hosts.gitcdn.top/hosts.txt)，将全部内容粘贴到系统 hosts 文件中。\n\n- **Linux / macOS**: `/etc/hosts`\n- **Windows**: `C:\\Windows\\System32\\drivers\\etc\\hosts`\n\n#### 刷新 DNS 缓存\n\n```bash\n# macOS\nsudo dscacheutil -flushcache \u0026\u0026 sudo killall -HUP mDNSResponder\n\n# Windows\nipconfig /flushdns\n\n# Linux\nsudo systemd-resolve --flush-caches\n```\n\n#### Linux/macOS 一键使用\n\n```bash\nsed -i \"/# fetch-github-hosts begin/Q\" /etc/hosts \u0026\u0026 curl https://hosts.gitcdn.top/hosts.txt \u003e\u003e /etc/hosts\n```\n\n\u003e 💡 可配合 crontab 定时任务实现自动更新\n\n## 📸 截图\n\n#### 客户端模式\n![client](assets/public/docs/client.png)\n\n#### 客户端启动\n![client-start](assets/public/docs/client-start.png)\n\n#### 客户端 Hosts 源选择\n![client-select](assets/public/docs/client-select.png)\n\n#### 客户端 Hosts 源自定义\n![client-custom](assets/public/docs/client-custom.png)\n\n#### 服务端模式\n![server](assets/public/docs/server.png)\n\n## 🌟 Star 趋势\n\n[![Stargazers over time](https://starchart.cc/Licoy/fetch-github-hosts.svg)](https://starchart.cc/Licoy/fetch-github-hosts)\n\n## 📄 开源协议\n\n[GPL-3.0](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicoy%2Ffetch-github-hosts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flicoy%2Ffetch-github-hosts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicoy%2Ffetch-github-hosts/lists"}