Loopback outbound: Add sniffing

https://github.com/XTLS/Xray-core/pull/6326
This commit is contained in:
Meow
2026-06-26 01:21:15 +08:00
parent 64a4231978
commit fb95880d75
3 changed files with 42 additions and 27 deletions
+14 -9
View File
@@ -2,6 +2,15 @@
Loopback 是一个环回出站,用于将流量重新送回 routing 处理,而无需离开核心。
::: tip 用途
- 在只能指定出站、不能直接写 `balancerTag` 的地方,借由 Loopback 间接使用 balancer<br>
例如链式代理中的 `proxySettings`、`dialerProxy` 和负载均衡中的 `fallbackTag`
- 流量已经分流过一次后,再按更多条件继续细分<br>
比如由同一组路由规则分流后的 TCP 流量和 UDP 要走不同的出站
:::
## OutboundConfigurationObject
`OutboundConfigurationObject` 对应 [`OutboundObject`](../outbound.md) 中的 `settings` 项。
@@ -12,9 +21,10 @@ Loopback 是一个环回出站,用于将流量重新送回 routing 处理,
{
// ...
"protocol": "loopback",
// [!code focus:3]
// [!code focus:4]
"settings": {
"inboundTag": "TagUseAsInbound"
"inboundTag": "TagUseAsInbound",
"sniffing": {}
}
}
]
@@ -27,11 +37,6 @@ Loopback 是一个环回出站,用于将流量重新送回 routing 处理,
该标识可以在路由中用于 `inboundTag`,表示该出站中的数据会以这个 tag 重新进入路由,并被对应的规则再次处理。
::: tip 用途
> `sniffing`: [SniffingObject](../inbound.md#sniffingobject)
- 在只能指定出站、不能直接写 `balancerTag` 的地方,借由 Loopback 间接使用 balancer<br>
例如链式代理中的 `proxySettings`、`dialerProxy` 和负载均衡中的 `fallbackTag`
- 流量已经分流过一次后,再按更多条件继续细分<br>
比如由同一组路由规则分流后的 TCP 流量和 UDP 要走不同的出站
:::
流量探测,具体配置和 [入站代理](../inbound.md#sniffingobject) 的相同。默认为不开启。
+14 -9
View File
@@ -2,6 +2,15 @@
Loopback is a loopback outbound used to send traffic back to routing for further processing without leaving the core.
::: tip Uses
- In places where only an outbound can be specified and `balancerTag` cannot be written directly, Loopback can be used to indirectly use a balancer.<br>
For example, `proxySettings` and `dialerProxy` in chained proxies, and `fallbackTag` in load balancing.
- After traffic has already been routed once, it can be further subdivided based on more conditions.<br>
For example, TCP traffic and UDP traffic routed by the same set of routing rules can be sent to different outbounds.
:::
## OutboundConfigurationObject
`OutboundConfigurationObject` corresponds to the `settings` item in [`OutboundObject`](../outbound.md).
@@ -12,9 +21,10 @@ Loopback is a loopback outbound used to send traffic back to routing for further
{
// ...
"protocol": "loopback",
// [!code focus:3]
// [!code focus:4]
"settings": {
"inboundTag": "TagUseAsInbound"
"inboundTag": "TagUseAsInbound",
"sniffing": {}
}
}
]
@@ -27,11 +37,6 @@ The inbound tag used when re-entering routing.
This tag can be used as `inboundTag` in routing, indicating that data from this outbound will re-enter routing with this tag and be processed again by the corresponding rules.
::: tip Uses
> `sniffing`: [SniffingObject](../inbound.md#sniffingobject)
- In places where only an outbound can be specified and `balancerTag` cannot be written directly, Loopback lets you use a balancer indirectly.<br>
For example, `proxySettings` and `dialerProxy` in chained proxies, and `fallbackTag` in load balancing.
- After traffic has already been routed once, it can be further subdivided using more conditions.<br>
For example, TCP traffic and UDP traffic split by the same set of routing rules can be sent to different outbounds.
:::
Traffic sniffing. The specific configuration is the same as that of [Inbound](../inbound.md#sniffingobject). Disabled by default.
+14 -9
View File
@@ -2,6 +2,15 @@
Loopback — это outbound с возвратом трафика, который отправляет трафик обратно в `routing` для повторной обработки, не выводя его за пределы ядра.
::: tip Применение
- В местах, где можно указать только outbound и нельзя напрямую задать `balancerTag`, Loopback позволяет косвенно использовать балансировщик.<br>
Например, `proxySettings` и `dialerProxy` в цепочках прокси, а также `fallbackTag` при балансировке нагрузки.
- После того как трафик уже был разделен один раз, его можно дополнительно детализировать по другим условиям.<br>
Например, TCP- и UDP-трафик, разделенные одной и той же группой правил routing, можно направить в разные outbound.
:::
## OutboundConfigurationObject
`OutboundConfigurationObject` соответствует элементу `settings` в [`OutboundObject`](../outbound.md).
@@ -12,9 +21,10 @@ Loopback — это outbound с возвратом трафика, которы
{
// ...
"protocol": "loopback",
// [!code focus:3]
// [!code focus:4]
"settings": {
"inboundTag": "TagUseAsInbound"
"inboundTag": "TagUseAsInbound",
"sniffing": {}
}
}
]
@@ -27,11 +37,6 @@ Loopback — это outbound с возвратом трафика, которы
Этот тег можно использовать в routing как `inboundTag`; это означает, что данные из этого outbound снова войдут в routing с этим тегом и будут повторно обработаны соответствующими правилами.
::: tip Применение
> `sniffing`: [SniffingObject](../inbound.md#sniffingobject)
- В местах, где можно указать только outbound и нельзя напрямую задать `balancerTag`, Loopback позволяет косвенно использовать балансировщик.<br>
Например, `proxySettings` и `dialerProxy` в цепочках прокси, а также `fallbackTag` в балансировке нагрузки.
- Если трафик уже был разделен один раз, его можно дополнительно детализировать по другим условиям.<br>
Например, TCP-трафик и UDP-трафик, разделенные одной и той же группой правил routing, можно направить в разные outbound.
:::
Распознавание трафика; настройки такие же, как у [входящего прокси](../inbound.md#sniffingobject). По умолчанию отключено.