跳到主要内容

代理配置参考

本章收录常用代理客户端的配置模板与参考示例,帮助你在拿到订阅链接或自建节点信息后,快速完成客户端的配置。

关于本章内容

本章侧重于「可以直接使用的配置模板」,协议原理和客户端详细功能说明请参阅对应的 代理协议代理软件 章节。


Mihomo(Clash Meta)配置模板

适用于 Mihomo 内核的客户端(Clash Verge Rev、Stash、FlClash 等)。

最小可用配置(订阅 + 分流)

# Mihomo 最小可用配置
# 将订阅链接填入 proxy-providers,或直接在 proxies 下手动填写节点

mixed-port: 7890 # HTTP + SOCKS5 混合端口
allow-lan: false # 是否允许局域网连接
mode: rule # 代理模式:rule(分流)/ global(全局)/ direct(直连)
log-level: warning # 日志级别

dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- https://doh.pub/dns-query # 国内 DNS
- https://dns.alidns.com/dns-query
fallback:
- https://1.1.1.1/dns-query # 境外 DNS
- https://8.8.8.8/dns-query
fallback-filter:
geoip: true
geoip-code: CN

proxy-providers:
airport:
type: http
url: "YOUR_SUBSCRIPTION_URL" # 替换为你的订阅链接
interval: 3600
health-check:
enable: true
url: https://www.gstatic.com/generate_204
interval: 300

proxy-groups:
- name: 🚀 节点选择
type: select
use:
- airport
proxies:
- ♻️ 自动选择
- DIRECT

- name: ♻️ 自动选择
type: url-test
use:
- airport
url: https://www.gstatic.com/generate_204
interval: 300
tolerance: 50

- name: 🌍 国外流量
type: select
proxies:
- 🚀 节点选择
- ♻️ 自动选择
- DIRECT

- name: 🐟 兜底分流
type: select
proxies:
- 🚀 节点选择
- DIRECT

rules:
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- GEOSITE,CN,DIRECT
- MATCH,🐟 兜底分流

手动添加单节点示例

proxies:
# Shadowsocks 2022
- name: "HK-SS2022"
type: ss
server: your.server.com
port: 8388
cipher: 2022-blake3-aes-128-gcm
password: "base64_encoded_key"

# VLESS + Reality
- name: "JP-VLESS-Reality"
type: vless
server: your.server.com
port: 443
uuid: "your-uuid"
flow: xtls-rprx-vision
tls: true
reality-opts:
public-key: "your-public-key"
short-id: "your-short-id"
servername: "microsoft.com"
client-fingerprint: chrome

# Hysteria 2
- name: "US-Hysteria2"
type: hysteria2
server: your.server.com
port: 36712
password: "your-password"
sni: your.server.com

sing-box 配置模板

适用于 sing-box 内核的客户端(sing-box 官方 App、Husi、Exclave 等)。

最小可用配置

{
"log": {
"level": "warn"
},
"dns": {
"servers": [
{
"tag": "google",
"address": "https://8.8.8.8/dns-query",
"detour": "proxy"
},
{
"tag": "local",
"address": "https://doh.pub/dns-query",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
},
{
"rule_set": "geosite-cn",
"server": "local"
}
],
"strategy": "prefer_ipv4"
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"strict_route": true,
"sniff": true
}
],
"outbounds": [
{
"type": "vless",
"tag": "proxy",
"server": "your.server.com",
"server_port": 443,
"uuid": "your-uuid",
"flow": "xtls-rprx-vision",
"tls": {
"enabled": true,
"reality": {
"enabled": true,
"public_key": "your-public-key",
"short_id": "your-short-id"
},
"server_name": "microsoft.com",
"utls": {
"enabled": true,
"fingerprint": "chrome"
}
}
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rule_set": [
{
"tag": "geosite-cn",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-cn.srs",
"download_detour": "proxy"
},
{
"tag": "geoip-cn",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
"download_detour": "proxy"
}
],
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"rule_set": "geoip-cn",
"outbound": "direct"
},
{
"rule_set": "geosite-cn",
"outbound": "direct"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"final": "proxy"
}
}

各协议节点参数速查

VLESS + Reality

参数说明
uuid用户 UUID,服务端生成
flowxtls-rprx-vision
public-keyReality 公钥,服务端生成
short-idReality Short ID,服务端生成
servername伪装 SNI,填真实存在的域名
fingerprintTLS 指纹,推荐 chrome

Hysteria 2

参数说明
server服务器地址
port服务器端口(UDP)
password认证密码
sniTLS SNI,填服务器域名
obfs混淆,salamander 类型(可选)

Shadowsocks 2022

参数说明
cipher加密方式:2022-blake3-aes-128-gcm2022-blake3-aes-256-gcm
passwordBase64 编码的密钥,用 openssl rand -base64 16 生成

TUIC v5

参数说明
uuid用户 UUID
password用户密码
sniTLS SNI
congestion拥塞控制,推荐 bbr

常见配置问题

订阅导入后节点全部超时?
先检查订阅格式是否与客户端兼容(Clash 格式 vs sing-box JSON 格式),再确认订阅链接本身能正常访问。

分流规则不生效,国内流量也走代理?
检查 DNS 模式是否正确(Mihomo 推荐 fake-ip),以及 GeoIP/Geosite 数据库文件是否是最新版本。

UDP 协议(Hysteria 2 / TUIC)无法连接?
确认服务端防火墙放行了对应 UDP 端口,客户端侧也确认没有 UDP 被封锁(可通过切换到 TCP 协议对比验证)。