Fetch GitHub Hosts
fetch-github-hosts 是主要为解决研究及学习人员访问 Github 过慢或其他问题而提供的 Github Hosts 同步工具
[color=var(--accent)] [color=var(--accent)] [color=var(--accent)]
原理此项目是通过部署此项目本身的服务器来获取 github.com 的 hosts,而不是通过第三方ip地址接口来进行获取,例如 ipaddress.com 等。 服务器赞助商[color=var(--accent)]使用方法图形化界面到 [color=var(--accent)]Releases 中下载您的系统版本(目前支持Windows/Linux/MacOS ) 下载完成解压tar.gz压缩包,运行对应平台的执行文件即可运行( ⚠️ 注意:Linux下需要用sudo进行启动,Windows和MacOS会自动进行提权操作。) 客户端模式客户端启动客户端hosts源选择客户端hosts源自定义服务端模式命令行终端到 [color=var(--accent)]Releases 中下载您的系统版本(目前支持Windows/Linux/MacOS ) 参数参数名 缩写 默认值 必填 描述
modem无是启动模式 server(服务端) / client(客户端)
intervali60否获取记录值间隔(分钟)
portp9898否服务模式监听端口以访问HTTP服务
urluhttps://hosts.gitcdn.top/hosts.txt否客户端模式远程hosts获取链接启动客户端:注意:
Linux下需要使用sudo运行;
Windows和MacOS会自动进行提权操作。
# Linux/Macossudo fetch-github-hosts -m=client# Windowsfetch-github-hosts.exe -m=client# Linux/Macos(10分钟获取一次)sudo fetch-github-hosts -i=10# Windows(10分钟获取一次)fetch-github-hosts.exe -i=10# Linux/Macossudo fetch-github-hosts -u=http://127.0.0.1:9898/hosts.json# Windowsfetch-github-hosts.exe -u=http://127.0.0.1:9898/hosts.json启动服务端:# Linux/Macosfetch-github-hosts -m=server# Windowsfetch-github-hosts.exe -m=server# Linux/Macosfetch-github-hosts -m=server -p=6666# Windowsfetch-github-hosts.exe -m=server -p=6666手动添加hosts- Linux / MacOS hosts路径:/etc/hosts
- Windows hosts路径:C:\Windows\System32\drivers\etc\hosts
刷新生效- Linux: /etc/init.d/network restart
- Windows: ipconfig /flushdns
- Macos: sudo killall -HUP mDNSResponder
Unix/Linux 一键使用sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts提示:可以设置crontab定时任务定时获取更新即可,解放双手!
私有部署下载最新的发行版(到 [color=var(--accent)]Releases 进行下载) ,并选择您的系统对应版本,直接以服务模式运行即可:fetch-github-hosts -m=server -p=9898,会自动监听0.0.0.0:9898,您可以直接浏览器访问 http://127.0.0.1:9898 以访问您自定义服务。 (具体方法可参见【启动服务端】小节详细说明) 注意:因网络影响,尽量部署到海外服务器节点!
|