- 🖥️ 跨平台桌面客户端 — 支持 macOS (Intel & Apple Silicon)、Windows、Linux
- 🔄 客户端模式 — 从远程源自动同步 Hosts 到系统
- 🌐 服务端模式 — 自建 DNS 解析服务,提供 HTTP API 供其他设备使用
- 🌓 深色/浅色/跟随系统 三种主题模式
- 🌍 多语言支持 — 简体中文、English、日本語
- 🔒 智能提权 — 首次写入 Hosts 时一次性授权,会话期间无需重复输入密码
- 📡 系统托盘 — 后台运行,一键启停
前往 Releases 下载对应平台安装包:
| 平台 | 文件类型 | 架构 |
|---|---|---|
| macOS | .dmg |
Universal (Intel + Apple Silicon) |
| Windows | .msi / .exe |
x86_64 |
| Linux | .deb / .AppImage |
x86_64 |
下载安装后直接运行即可,提供图形化界面操作。
从远程 Hosts 源获取最新的 GitHub 相关 DNS 记录,自动写入系统 hosts 文件。
- 支持多种 Hosts 源(FetchGithubHosts、Github520)
- 支持自定义远程 URL
- 可设置自动获取间隔(分钟)
在本地启动 HTTP 服务,自动解析 GitHub 域名并提供 hosts 文件下载。
- 默认监听端口
9898 - 提供
hosts.txt(纯文本)和hosts.json(JSON)两种格式 - 内置美观的 Web 页面,支持深色/浅色主题和多语言
到 Releases 中下载您的系统版本,可以直接通过命令行使用。
| 参数名 | 缩写 | 默认值 | 描述 |
|---|---|---|---|
--mode |
-m |
无(启动 GUI) | 启动模式:client(客户端)/ server(服务端) |
--interval |
-i |
60 |
获取 hosts 的间隔时间(分钟) |
--port |
-p |
9898 |
服务端模式监听端口 |
--url |
-u |
https://hosts.gitcdn.top/hosts.txt |
客户端模式远程 hosts 获取链接 |
--template |
-t |
无(使用内置模板) | 服务端模式自定义 HTML 模板文件路径 |
--lang |
-l |
自动检测 | 界面语言(zh-CN、en-US、ja-JP) |
# Linux/macOS
sudo ./fetch-github-hosts -m client
# Windows
fetch-github-hosts.exe -m client
# 自定义获取间隔(10分钟)
sudo ./fetch-github-hosts -m client -i 10
# 自定义获取链接
sudo ./fetch-github-hosts -m client -u http://127.0.0.1:9898/hosts.json# Linux/macOS
./fetch-github-hosts -m server
# Windows
fetch-github-hosts.exe -m server
# 自定义端口
./fetch-github-hosts -m server -p 6666
# 自定义 HTML 模板文件
./fetch-github-hosts -m server -t /path/to/template.html💡 自定义模板支持
{{FGH_VERSION}}(版本号)和{{FGH_UPDATE_TIME}}(最近更新时间)两个模板变量
💡 不指定
-m参数时将启动图形化界面
访问 https://hosts.gitcdn.top/hosts.txt,将全部内容粘贴到系统 hosts 文件中。
- Linux / macOS:
/etc/hosts - Windows:
C:\Windows\System32\drivers\etc\hosts
# macOS
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
# Windows
ipconfig /flushdns
# Linux
sudo systemd-resolve --flush-cachessed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts💡 可配合 crontab 定时任务实现自动更新





