MCPcopy Index your code
hub / github.com/Licoy/fetch-github-hosts

github.com/Licoy/fetch-github-hosts @v4.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.0.3 ↗ · + Follow
93 symbols 175 edges 15 files 43 documented · 46%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

简体中文 | English | 日本語

Fetch GitHub Hosts

Logo

A GitHub Hosts synchronization tool designed to help researchers and learners access GitHub faster

Release GitHub Stars License

✨ Features

  • 🖥️ Cross-platform Desktop App — Supports macOS (Intel & Apple Silicon), Windows, Linux
  • 🔄 Client Mode — Automatically sync hosts from remote sources to your system
  • 🌐 Server Mode — Self-hosted DNS resolution service with HTTP API
  • 🌓 Dark / Light / System theme modes
  • 🌍 Multi-language — 简体中文, English, 日本語
  • 🔒 Smart Elevation — One-time password prompt, no repeated authorization needed
  • 📡 System Tray — Run in background with one-click start/stop

📦 Installation

Download from Releases:

Platform File Type Architecture
macOS .dmg Universal (Intel + Apple Silicon)
Windows .msi / .exe x86_64
Linux .deb / .AppImage x86_64

🚀 Usage

Desktop Client

Download, install, and run. The app provides a graphical user interface.

Client Mode

Fetches the latest GitHub DNS records from remote hosts sources and writes them to the system hosts file.

  • Multiple hosts sources (FetchGithubHosts, Github520)
  • Custom remote URL support
  • Configurable auto-fetch interval (minutes)

Server Mode

Starts a local HTTP server that auto-resolves GitHub domains and serves hosts files.

  • Default port: 9898
  • Provides hosts.txt (plain text) and hosts.json (JSON) formats
  • Built-in web page with dark/light theme and multi-language support

Command Line

Download your platform's binary from Releases and use it directly in the terminal.

Parameters

Parameter Short Default Description
--mode -m None (opens GUI) Mode: client or server
--interval -i 60 Fetch interval in minutes
--port -p 9898 Server mode listening port
--url -u https://hosts.gitcdn.top/hosts.txt Client mode remote hosts URL
--template -t None (built-in) Server mode custom HTML template file path
--lang -l Auto-detect Language (zh-CN, en-US, ja-JP)

Start Client

# Linux/macOS
sudo ./fetch-github-hosts -m client

# Windows
fetch-github-hosts.exe -m client

# Custom interval (every 10 minutes)
sudo ./fetch-github-hosts -m client -i 10

# Custom URL
sudo ./fetch-github-hosts -m client -u http://127.0.0.1:9898/hosts.json

Start Server

# Linux/macOS
./fetch-github-hosts -m server

# Windows
fetch-github-hosts.exe -m server

# Custom port
./fetch-github-hosts -m server -p 6666

# Custom HTML template
./fetch-github-hosts -m server -t /path/to/template.html

💡 Custom templates support {{FGH_VERSION}} (version) and {{FGH_UPDATE_TIME}} (last update time) template variables

💡 Omitting the -m parameter launches the graphical user interface

Manual Method

Add Hosts

Visit https://hosts.gitcdn.top/hosts.txt and paste the content into your system hosts file.

  • Linux / macOS: /etc/hosts
  • Windows: C:\Windows\System32\drivers\etc\hosts

Flush DNS Cache

# macOS
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

# Windows
ipconfig /flushdns

# Linux
sudo systemd-resolve --flush-caches

One-liner for Linux/macOS

sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts

💡 Set up a crontab task for automatic updates

📸 Screenshots

Client Mode

client

Client Started

client-start

Hosts Source Selection

client-select

Custom Hosts Source

client-custom

Server Mode

server

🌟 Star History

Stargazers over time

📄 License

GPL-3.0

Extension points exported contracts — how you extend this code

ClientConfig (Interface)
* Shared config composable — single source of truth for AppConfig. * Both ClientMode and ServerMode read/write through
composables/useConfig.ts
ServerConfig (Interface)
(no doc)
composables/useConfig.ts
AppConfig (Interface)
(no doc)
composables/useConfig.ts

Core symbols most depended-on inside this repo

cli_log
called by 10
src-tauri/src/cli.rs
tray_text
called by 8
src-tauri/src/lib.rs
isTauri
called by 8
composables/useTauri.ts
config_dir
called by 4
src-tauri/src/config.rs
load_config
called by 4
src-tauri/src/config.rs
log_payload
called by 4
src-tauri/src/services.rs
logs_dir
called by 3
src-tauri/src/config.rs
client_fetch_hosts
called by 3
src-tauri/src/services.rs

Shape

Function 81
Class 8
Interface 3
Method 1

Languages

Rust80%
TypeScript20%

Modules by API surface

src-tauri/src/commands.rs17 symbols
src-tauri/src/services.rs11 symbols
src-tauri/src/models.rs11 symbols
src-tauri/src/hosts.rs10 symbols
composables/useTauri.ts9 symbols
src-tauri/src/config.rs8 symbols
composables/useConfig.ts8 symbols
src-tauri/src/cli.rs6 symbols
src-tauri/src/lib.rs5 symbols
src-tauri/src/dns.rs4 symbols
composables/useAppVersion.ts2 symbols
src-tauri/src/main.rs1 symbols

For agents

$ claude mcp add fetch-github-hosts \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact