一、工具介紹
Fetch GitHub Hosts是一款開源跨平臺(tái)的國內(nèi)GitHub加速訪問工具,主要為解決研究及學(xué)習(xí)人員訪問 Github 過慢或其他問題而提供的 Github Hosts 同步工具。
項(xiàng)目原理:是通過部署此項(xiàng)目本身的服務(wù)器來獲取 github.com 的 hosts,而不是通過第三方ip地址接口來進(jìn)行獲取,例如 ipaddress.com 等。
二、使用方法
圖形化界面
軟件支持圖像化界面操作,不用直接操作hosts,對(duì)小白也非常友好且方便
下載完成解壓壓縮包,運(yùn)行對(duì)應(yīng)平臺(tái)的執(zhí)行文件即可運(yùn)行(??注意:Linux下需要用進(jìn)行啟動(dòng),Windows和MacOS會(huì)自動(dòng)進(jìn)行提權(quán)操作。)
客戶端模式
客戶端啟動(dòng)?
客戶端主機(jī)源選擇
?客戶端主機(jī)源自定義
?服務(wù)端模式
三、命令行終端?
參數(shù)
參數(shù)名 | 縮寫 | 默認(rèn)值 | 必填 | 描述 |
---|---|---|---|---|
mode |
m |
無 | 是 | 啟動(dòng)模式server(服務(wù)端)/ client(客戶端)
|
interval |
i |
60 | 否 | 獲取記錄值間隔(分鐘) |
port |
p |
9898 | 否 | 服務(wù)模式監(jiān)聽端口以訪問HTTP服務(wù) |
url |
u |
https://hosts.gitcdn.top/hosts.txt |
否 | 客戶端模式遠(yuǎn)程主機(jī)獲取鏈接 |
啟動(dòng)客戶端
注意:
Linux下需要使用運(yùn)行;
sudo
Windows和MacOS會(huì)自動(dòng)進(jìn)行提權(quán)操作。?
- 直接運(yùn)行
# Linux/Macos
sudo fetch-github-hosts -m=client
# Windows
fetch-github-hosts.exe -m=client
- 自定義獲取時(shí)間間隔
# Linux/Macos(10分鐘獲取一次)
sudo fetch-github-hosts -i=10
# Windows(10分鐘獲取一次)
fetch-github-hosts.exe -i=10
- 自定義獲取鏈接
# Linux/Macos
sudo fetch-github-hosts -u=http://127.0.0.1:9898/hosts.json
# Windows
fetch-github-hosts.exe -u=http://127.0.0.1:9898/hosts.json
啟動(dòng)服務(wù)端
- 直接運(yùn)行
# Linux/Macos
fetch-github-hosts -m=server
# Windows
fetch-github-hosts.exe -m=server
- 自定義監(jiān)聽端口
# Linux/Macos
fetch-github-hosts -m=server -p=6666
# Windows
fetch-github-hosts.exe -m=server -p=6666
手動(dòng)
?添加主機(jī)
將以下全部?jī)?nèi)容粘貼到你的hosts文件中,即可。
# fetch-github-hosts begin
140.82.112.26 alive.github.com
140.82.114.25 live.github.com
185.199.111.154 github.githubassets.com
140.82.113.21 central.github.com
185.199.110.133 desktop.githubusercontent.com
2606:50c0:8001::153 assets-cdn.github.com
185.199.111.133 camo.githubusercontent.com
185.199.108.133 github.map.fastly.net
151.101.161.194 github.global.ssl.fastly.net
140.82.114.3 gist.github.com
185.199.110.153 github.io
140.82.113.3 github.com
192.0.66.2 github.blog
140.82.114.5 api.github.com
2606:50c0:8003::154 raw.githubusercontent.com
2606:50c0:8002::154 user-images.githubusercontent.com
185.199.110.133 favicons.githubusercontent.com
185.199.109.133 avatars5.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.110.133 avatars3.githubusercontent.com
185.199.111.133 avatars2.githubusercontent.com
185.199.109.133 avatars1.githubusercontent.com
185.199.111.133 avatars0.githubusercontent.com
2606:50c0:8000::154 avatars.githubusercontent.com
140.82.112.9 codeload.github.com
54.231.171.201 github-cloud.s3.amazonaws.com
3.5.8.134 github-com.s3.amazonaws.com
52.217.40.244 github-production-release-asset-2e65be.s3.amazonaws.com
52.217.9.60 github-production-user-asset-6210df.s3.amazonaws.com
52.217.160.97 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.109.153 githubstatus.com
140.82.114.18 github.community
52.224.38.193 github.dev
140.82.112.22 collector.github.com
2620:1ec:21::16 pipelines.actions.githubusercontent.com
2606:50c0:8000::154 media.githubusercontent.com
185.199.110.133 cloud.githubusercontent.com
185.199.110.133 objects.githubusercontent.com
# last fetch time: 2023-08-03 10:42:51
# update url: https://hosts.gitcdn.top/hosts.txt
# fetch-github-hosts end
-
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
提示:可以設(shè)置crontab定時(shí)任務(wù)定時(shí)獲取更新即可,解放雙手!
?四、私有部署
?略文章來源:http://www.zghlxwxcb.cn/news/detail-638628.html
五、國內(nèi)GitHub加速訪問工具GitHub地址
?地址:點(diǎn)擊前往下載文章來源地址http://www.zghlxwxcb.cn/news/detail-638628.html
到了這里,關(guān)于國內(nèi)GitHub加速訪問工具-Fetch GitHub Hosts的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!