简体中文 | English
fetch-github-hosts
is a Github Hosts
synchronization tool mainly provided to solve the problem of slow access to Github
or other problems for research and learning personnel.
go build -tags="no_gui"
This project obtains the hosts
of github.com
by deploying the server of the project itself, rather than through a third-party IP address interface, such as ipaddress.com
, etc.
Go to Releases to download your system version (currently supports Windows
/Linux
/MacOS
)
After the download is completed, unzip the tar.gz
compressed package and run the executable file of the corresponding platform to run (sudo
, Windows and MacOS will automatically perform privilege escalation operations.)
Go to Releases to download your system version (currently supports Windows
/Linux
/MacOS
)
Parameter name | Abbreviation | Default value | Required | Description |
---|---|---|---|---|
mode |
m |
None | Yes | Startup mode server / client |
interval |
i |
60 | No | Get the record value interval (minutes) |
port |
p |
9898 | No | Service mode listening port to access the HTTP service |
url |
u |
https://hosts.gitcdn.top/hosts.txt |
No | Client mode remote hosts get link |
lang |
l |
zh-CN |
No | Interface language |
Note:
You need to use
sudo
to run under Linux;Windows and MacOS will automatically perform privilege escalation operations.
- run directly
#Linux/Macos
sudo fetch-github-hosts -m=client
# Windows
fetch-github-hosts.exe -m=client
- Customize the acquisition time interval
# Linux/Macos (obtained once every 10 minutes)
sudo fetch-github-hosts -i=10
# Windows (obtained once every 10 minutes)
fetch-github-hosts.exe -i=10
- Customized get link
#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
- run directly
#Linux/Macos
fetch-github-hosts -m=server
# Windows
fetch-github-hosts.exe -m=server
- Custom listening port
#Linux/Macos
fetch-github-hosts -m=server -p=6666
# Windows
fetch-github-hosts.exe -m=server -p=6666
Visit https://hosts.gitcdn.top/hosts.txt , Paste its entire contents into your hosts file.
Linux/MacOS
hosts path:/etc/hosts
Windows
hosts path:C:\Windows\System32\drivers\etc\hosts
Linux
:/etc/init.d/network restart
Windows
:ipconfig /flushdns
Macos
:sudo killall -HUP mDNSResponder
sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts
Tip: You can set up a crontab scheduled task to get updates regularly, freeing your hands!
Download the latest release (go to Releases to download)
, and select the corresponding version of your system, and run it directly in service mode: fetch-github-hosts -m=server -p=9898
, which will automatically monitor 0.0.0.0:9898
, and you can access it directly with a browser http://127.0.0.1:9898
to access your customized services.
(For specific methods, please refer to the section [Start Server] for detailed instructions)
Note: Due to network influence, try to deploy to overseas server nodes!