|
| 1 | +[简体中文](./README.md) | English |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | +<h2>Fetch GitHub Hosts</h2> |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +`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. |
| 9 | + |
| 10 | +[](https://github.com/Licoy/fetch-github-hosts) |
| 11 | +[](https://github.com/Licoy/fetch-github-hosts) |
| 12 | +[](https://github.com/Licoy/fetch-github-hosts) |
| 13 | + |
| 14 | +</div> |
| 15 | + |
| 16 | +## Principle |
| 17 | + |
| 18 | +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. |
| 19 | + |
| 20 | +## Instructions |
| 21 | +### Graphical interface |
| 22 | +Go to [Releases](https://github.com/Licoy/fetch-github-hosts/releases) to download your system version (currently supports `Windows`/`Linux`/`MacOS` |
| 23 | +) |
| 24 | + |
| 25 | +After the download is completed, unzip the `tar.gz` compressed package and run the executable file of the corresponding platform to run (⚠️ Note: Linux needs to be started with `sudo`, Windows and MacOS will automatically perform privilege escalation operations.) |
| 26 | + |
| 27 | +#### Client mode |
| 28 | + |
| 29 | + |
| 30 | +#### Client startup |
| 31 | + |
| 32 | + |
| 33 | +#### Client hosts source selection |
| 34 | + |
| 35 | + |
| 36 | +#### Client hosts are derived from customization |
| 37 | + |
| 38 | + |
| 39 | +#### Server mode |
| 40 | + |
| 41 | + |
| 42 | +### Command line terminal |
| 43 | + |
| 44 | +Go to [Releases](https://github.com/Licoy/fetch-github-hosts/releases) to download your system version (currently supports `Windows`/`Linux`/`MacOS` |
| 45 | +) |
| 46 | + |
| 47 | +#### Parameters |
| 48 | + |
| 49 | +| Parameter name | Abbreviation | Default value | Required | Description | |
| 50 | +|----------------|--------------|--------------------------------------|----------|--------------------------------------------------------| |
| 51 | +| `mode` | `m` | None | Yes | Startup mode `server` / `client` | |
| 52 | +| `interval` | `i` | 60 | No | Get the record value interval (minutes) | |
| 53 | +| `port` | `p` | 9898 | No | Service mode listening port to access the HTTP service | |
| 54 | +| `url` | `u` | `https://hosts.gitcdn.top/hosts.txt` | No | Client mode remote hosts get link | |
| 55 | +| `lang` | `l` | `zh-CN` | No | Interface language | |
| 56 | + |
| 57 | +#### Start the client: |
| 58 | + |
| 59 | +> Note: |
| 60 | +> |
| 61 | +> You need to use `sudo` to run under Linux; |
| 62 | +> |
| 63 | +> Windows and MacOS will automatically perform privilege escalation operations. |
| 64 | +
|
| 65 | +- run directly |
| 66 | + |
| 67 | +```bash |
| 68 | +#Linux/Macos |
| 69 | +sudo fetch-github-hosts -m=client |
| 70 | + |
| 71 | +# Windows |
| 72 | +fetch-github-hosts.exe -m=client |
| 73 | +``` |
| 74 | + |
| 75 | +- Customize the acquisition time interval |
| 76 | + |
| 77 | +```bash |
| 78 | +# Linux/Macos (obtained once every 10 minutes) |
| 79 | +sudo fetch-github-hosts -i=10 |
| 80 | + |
| 81 | +# Windows (obtained once every 10 minutes) |
| 82 | +fetch-github-hosts.exe -i=10 |
| 83 | +``` |
| 84 | + |
| 85 | +- Customized get link |
| 86 | + |
| 87 | +```bash |
| 88 | +#Linux/Macos |
| 89 | +sudo fetch-github-hosts -u=http://127.0.0.1:9898/hosts.json |
| 90 | + |
| 91 | +# Windows |
| 92 | +fetch-github-hosts.exe -u=http://127.0.0.1:9898/hosts.json |
| 93 | +``` |
| 94 | + |
| 95 | +#### Start the server: |
| 96 | + |
| 97 | +- run directly |
| 98 | + |
| 99 | +```bash |
| 100 | +#Linux/Macos |
| 101 | +fetch-github-hosts -m=server |
| 102 | + |
| 103 | +# Windows |
| 104 | +fetch-github-hosts.exe -m=server |
| 105 | +``` |
| 106 | + |
| 107 | +- Custom listening port |
| 108 | + |
| 109 | +```bash |
| 110 | +#Linux/Macos |
| 111 | +fetch-github-hosts -m=server -p=6666 |
| 112 | + |
| 113 | +# Windows |
| 114 | +fetch-github-hosts.exe -m=server -p=6666 |
| 115 | +``` |
| 116 | + |
| 117 | +### Manual |
| 118 | + |
| 119 | +#### Add hosts |
| 120 | + |
| 121 | +Visit [https://hosts.gitcdn.top/hosts.txt](https://hosts.gitcdn.top/hosts.txt) , |
| 122 | +Paste its entire contents into your hosts file. |
| 123 | + |
| 124 | +- `Linux/MacOS` hosts path: `/etc/hosts` |
| 125 | +- `Windows` hosts path: `C:\Windows\System32\drivers\etc\hosts` |
| 126 | + |
| 127 | +#### Refresh takes effect |
| 128 | + |
| 129 | +- `Linux`: `/etc/init.d/network restart` |
| 130 | +- `Windows`: `ipconfig /flushdns` |
| 131 | +- `Macos`: `sudo killall -HUP mDNSResponder` |
| 132 | + |
| 133 | +#### Unix/Linux one-click use |
| 134 | + |
| 135 | +```shell |
| 136 | +sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts |
| 137 | +``` |
| 138 | + |
| 139 | +> Tip: You can set up a crontab scheduled task to get updates regularly, freeing your hands! |
| 140 | +
|
| 141 | +## Private deployment |
| 142 | + |
| 143 | +Download the latest release (go to [Releases](https://github.com/Licoy/fetch-github-hosts/releases) to download) |
| 144 | +, 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` |
| 145 | +to access your customized services. |
| 146 | +(For specific methods, please refer to the section [Start Server] for detailed instructions) |
| 147 | + |
| 148 | +> Note: Due to network influence, try to deploy to overseas server nodes! |
| 149 | +
|
| 150 | +## Trend |
| 151 | +[](https://starchart.cc/Licoy/fetch-github-hosts) |
| 152 | + |
| 153 | +## Open Source Agreement |
| 154 | + |
| 155 | +[GPL 3.0](https://github.com/Licoy/fetch-github-hosts/blob/main/LICENSE) |
0 commit comments