Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

路由配置策略与outbounds配置顺序需要搭配 #49

Open
echodidi opened this issue Feb 14, 2019 · 0 comments
Open

路由配置策略与outbounds配置顺序需要搭配 #49

echodidi opened this issue Feb 14, 2019 · 0 comments

Comments

@echodidi
Copy link

首先谢谢大佬的教程!
然后下面是遇到的一个问题及解决方法,希望对其他人有点用。

https://toutyrater.github.io/routing/sitedata.html#外置的域名文件 配置路由时,rules段如下,
"rules":[
{
"type": "field",
"outboundTag": "proxy",
"domain": [
"ext:h2y.dat:gfw"
]
}
]

但国内网站还是走代理,后来发现,在https://toutyrater.github.io/basic/routing/cndirect.html#说明 里有一句,

这因为 outbounds 中的第一个出口协议是作为默认的出口,当一个数据包没有匹配的规则时,路由就会把数据包发往默认出口

于是把outbounds里面的direct配置放到第一个去,这样就行了,如下,
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"vnext": null,
"servers": null,
"response": null
},
"streamSettings": null,
"mux": null
},
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "...................",
"port": ...........,
"users": [
{
"id": "........................",
"alterId": 16,
"security": "aes-128-gcm"
}
]
}
],
"servers": null,
"response": null
},
"streamSettings": {
"network": "tcp",
"security": "",
"tlsSettings": null,
"tcpSettings": null,
"kcpSettings": null,
"wsSettings": null,
"httpSettings": null
},
"mux": {
"enabled": true
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"vnext": null,
"servers": null,
"response": {
"type": "http"
}
},
"streamSettings": null,
"mux": null
}
]

outbounds里面的第一个配置一般默认都是走代理的,但是路由配置成被 gfw 屏蔽的域名走代理后,国内域名因为不会匹配到这一条规则,就会直接按默认的第一个配置走代理,把direct放到第一个之后,国内域名就会直连了。相应的,如果路由配置成国内直连,那outbounds里面的第一个配置就要是走代理的。

作者后续更新的话,希望可以在路由配置里稍微提一下,路由配置策略与outbounds配置顺序需要搭配。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant