Refine loopback

This commit is contained in:
Meow
2026-06-15 06:33:09 +08:00
parent d93ce618eb
commit f37805efcd
3 changed files with 27 additions and 120 deletions
+9 -40
View File
@@ -1,6 +1,6 @@
# Loopback
Loopback is an outbound data protocol. Its function is to re-inject data sent through this outbound back into the routing inbound, allowing the data to be processed by the routing system again without leaving Xray-core.
Loopback is a loopback outbound used to send traffic back to routing for further processing without leaving the core.
## OutboundConfigurationObject
@@ -23,46 +23,15 @@ Loopback is an outbound data protocol. Its function is to re-inject data sent th
> `inboundTag`: string
The inbound protocol identifier used for re-routing.
The inbound tag used when re-entering routing.
This identifier can be used for `inboundTag` in routing rules, indicating that data from this outbound can be processed again by the corresponding routing rules.
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.
### How to use?
::: tip Uses
If you need to perform finer-grained splitting on traffic that has already been split by routing rules—for example, if TCP traffic and UDP traffic split by the same group of routing rules need to go through different outbounds—you can use the `loopback` outbound to achieve this.
- 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.
```json
{
"outbounds": [
{
"protocol": "loopback",
"tag": "need-to-split",
"settings": {
"inboundTag": "traffic-input" // This tag is used for the inboundTag of RuleObject below
}
},
{
"tag": "tcp-output"
// settings like protocol, settings, streamSettings
},
{
"tag": "udp-output"
// settings like protocol, settings, streamSettings
}
],
"routing": {
"rules": [
{
"inboundTag": ["traffic-input"], // tag set in loopback
"network": "tcp",
"outboundTag": "tcp-output"
},
{
"inboundTag": ["traffic-input"], // tag set in loopback
"network": "udp",
"outboundTag": "udp-output"
}
]
}
}
```
:::