安装 Clash 确保你已经安装了 Clash 工具,如果没有安装,可以从 Clash 的官方网站 或其GitHub仓库获取。 配置 Clash Clash 的配置文件通常位于用户的主目录下,文件名为 clash.json,在 Windows 中,通常位于 C:\Users\[你的用户名]\Documents\Clash\clash.json;在 macOS 或 Linux 中,位于 ~/.clash/clash.json。 添加订阅链接 要配置 Clash 的订阅链接,可以在 clash.json 中添加订阅链接,以下是一个示例配置: { "clash": { "proxy": "socks5://localhost:108", "socks": { "1": "socks5://localhost:108" }, "rules": [ { "domain": "www.example.com", "ip": "...", "type": "reject", "port": 80 } ], "subscriptions": [ { "name": "Gitee", "url": "https://gitee.com/yourusername/Clash-Subscriptions/raw/master/sub.json" } ] } } 解释配置 proxy:配置代理地址,在示例中,代理地址是 socks5://localhost:108,这是一个本地 SOCKS 代理。 socks:配置 socks...
安装 Clash
确保你已经安装了 Clash 工具,如果没有安装,可以从 Clash 的官方网站 或其GitHub仓库获取。
配置 Clash
Clash 的配置文件通常位于用户的主目录下,文件名为 clash.json,在 Windows 中,通常位于 C:\Users\[你的用户名]\Documents\Clash\clash.json;在 macOS 或 Linux 中,位于 ~/.clash/clash.json。
添加订阅链接
要配置 Clash 的订阅链接,可以在 clash.json 中添加订阅链接,以下是一个示例配置:
{
"clash": {
"proxy": "socks5://localhost:108",
"socks": {
"1": "socks5://localhost:108"
},
"rules": [
{
"domain": "www.example.com",
"ip": "...",
"type": "reject",
"port": 80
}
],
"subscriptions": [
{
"name": "Gitee",
"url": "https://gitee.com/yourusername/Clash-Subscriptions/raw/master/sub.json"
}
]
}
}
解释配置
proxy:配置代理地址,在示例中,代理地址是socks5://localhost:108,这是一个本地 SOCKS 代理。socks:配置 socks 代理规则,在示例中,socks数组中的每个条目都指定了一个 socks 代理地址,可以根据需要添加更多地址。rules:配置路由规则,每个规则可以指定一个域名、IP 地址、规则类型(如reject、rewrite或passthrough)和端口。subscriptions:配置订阅链接,在示例中,subscriptions数组中的每个条目指定了一个订阅链接,Clash 会从这些链接下载最新的订阅规则。
添加更多订阅链接
你可以添加多个订阅链接,以获取更多的域名和路由规则,添加一个 GitHub 存储库的订阅链接:
{
"clash": {
"subscriptions": [
{
"name": "Gitee",
"url": "https://gitee.com/yourusername/Clash-Subscriptions/raw/master/sub.json"
},
{
"name": "GitHub",
"url": "https://github.com/yourusername/Clash-Subscriptions/raw/master/sub.json"
}
]
}
}
使用订阅链接
Clash 会从订阅链接中下载最新的订阅信息,并应用到你的网络环境中,你可以手动启用或禁用每个订阅链接下的规则。
常见问题
- 如果订阅链接不可用,确保链接正确且服务器返回有效的 JSON 格式。
- Clash 无法解析 JSON 格式,检查 JSON 文件的语法是否正确。
- 如果你使用 GitHub 或 Gitee 等平台,确保你有权限访问这些仓库,并且订阅链接是公开的。
通过上述步骤,你可以轻松配置 Clash 的订阅链接,并管理你的网络代理和路由规则。

相关文章







