是否有办法将所有不匹配的流量直接传输到互联网,而无需定义必要的域? #5781
-
|
让我为必须在服务器中传递到互联网的域和IP制定规则,并为客户端制定相应的规则。我想将所有不匹配的域或IP传递给客户端中的direct和服务器中的block。我该怎么做? 以防万一,我是X光核心的新手。 下面是我的客户端和服务器的路由表,以及我从中获得的geoip和geosite数据:
以下是客户端路由: "routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"ip": [
"geoip:yandex"
],
"outboundTag": "direct"
},
{
"domain": [
"geosite:ru-available-only-inside",
"regexp:^.*\\.ru$"
],
"outboundTag": "direct"
},
{
"ip": [
"geoip:ru-blocked",
"geoip:cloudflare",
"geoip:cloudfront",
"geoip:facebook",
"geoip:fastly",
"geoip:google",
"geoip:netflix",
"geoip:telegram",
"geoip:twitter",
"geoip:ddos-guard"
],
"outboundTag": "proxy"
},
{
"domain": [
"geosite:youtube",
"geosite:ru-blocked",
"regexp:^(^.*\\.ru$)"
],
"outboundTag": "proxy"
}
]
}以下是服务器路由: "routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"protocol": "bittorrent",
"outboundTag": "block"
},
{
"ip": [
"geoip:yandex"
],
"outboundTag": "block"
},
{
"domain": [
"geosite:ru-available-only-inside",
"regexp:.*\\.ru$"
],
"outboundTag": "block"
},
{
"ip": [
"geoip:ru-blocked",
"geoip:cloudflare",
"geoip:cloudfront",
"geoip:facebook",
"geoip:fastly",
"geoip:google",
"geoip:netflix",
"geoip:telegram",
"geoip:twitter",
"geoip:ddos-guard"
],
"outboundTag": "direct"
},
{
"domain": [
"geosite:youtube",
"geosite:ru-blocked",
"regexp:^(^.*\\.ru$)"
],
"outboundTag": "direct"
}
]
} |
Beta Was this translation helpful? Give feedback.
Answered by
vrnobody
Mar 10, 2026
Replies: 1 comment 2 replies
-
|
When there is no matching rule, xray-core will use the first outbound. Therefore, a simple solution is to move 'direct' to the top of client's outbounds config, and move 'block' to the top of server's outbounds config. Another solution is to add a universal rule #4371 at the bottom of routing rules: {
"type": "field", // 兜底规则
"network": "tcp,udp", // 加入
"outboundTag": "direct" // 其他流量走直连
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
AtaarSatag
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When there is no matching rule, xray-core will use the first outbound. Therefore, a simple solution is to move 'direct' to the top of client's outbounds config, and move 'block' to the top of server's outbounds config.
Another solution is to add a universal rule #4371 at the bottom of routing rules:
{ "type": "field", // 兜底规则 "network": "tcp,udp", // 加入 "outboundTag": "direct" // 其他流量走直连 }