diff --git a/docs/.vuepress/config/sidebar/en.ts b/docs/.vuepress/config/sidebar/en.ts index b9d0146..af8de26 100755 --- a/docs/.vuepress/config/sidebar/en.ts +++ b/docs/.vuepress/config/sidebar/en.ts @@ -49,6 +49,7 @@ export const sidebarEn: SidebarConfig = { '/en/config/outbounds/dns.md', '/en/config/outbounds/freedom.md', '/en/config/outbounds/http.md', + '/en/config/outbounds/loopback.md', '/en/config/outbounds/shadowsocks.md', '/en/config/outbounds/socks.md', '/en/config/outbounds/trojan.md', diff --git a/docs/.vuepress/config/sidebar/zh.ts b/docs/.vuepress/config/sidebar/zh.ts index 5039c43..87112d7 100755 --- a/docs/.vuepress/config/sidebar/zh.ts +++ b/docs/.vuepress/config/sidebar/zh.ts @@ -49,6 +49,7 @@ export const sidebarZh: SidebarConfig = { '/config/outbounds/dns.md', '/config/outbounds/freedom.md', '/config/outbounds/http.md', + '/config/outbounds/loopback.md', '/config/outbounds/shadowsocks.md', '/config/outbounds/socks.md', '/config/outbounds/trojan.md', diff --git a/docs/config/outbounds/loopback.md b/docs/config/outbounds/loopback.md index 3787e84..79b896f 100644 --- a/docs/config/outbounds/loopback.md +++ b/docs/config/outbounds/loopback.md @@ -15,3 +15,43 @@ Loopback 是个出站数据协议,其作用为将经该出站传出的数据 用于重新路由的入站协议标识。 该标识可以在路由中用于 `inboundTag` ,表示该出站中的数据可以被对应的路由规则再次处理。 + +### 如何使用? + +如果需要将已经通过路由规则分流过的流量再由其它路由规则做更细致的分流,比如由同一组路由规则分流后的 TCP 流量和 UDP 要走不同的出站,则可以使用 `loopback` 出站完成。 + +``` jsonc +{ + "outbounds": [ + { + "protocol": "loopback", + "tag": "need-to-split", + "settings": { + "tag": "traffic-input" // 该 tag 在下方用于 RuleObject 的 inboundTag + } + }, + { + "tag": "tcp-output", + // protocol, settings, streamSettings 之类的设置 + }, + { + "tag": "udp-output", + // protocol, settings, streamSettings 之类的设置 + } + ], + "routing": { + "rules": [ + { + "inboundTag": ["traffic-input"], // loopback 设定的 tag + "network": "tcp", + "outboundTag": "tcp-output" + }, + { + "inboundTag": ["traffic-input"], // loopback 设定的 tag + "network": "udp", + "outboundTag": "udp-output" + } + ] + } +} +``` \ No newline at end of file diff --git a/docs/en/config/outbounds/loopback.md b/docs/en/config/outbounds/loopback.md index d4cc770..6405e25 100644 --- a/docs/en/config/outbounds/loopback.md +++ b/docs/en/config/outbounds/loopback.md @@ -15,3 +15,43 @@ Loopback is an outbound protocol. It can send traffics through corresponding out Use as an inbound tag for routing. This tag can be used as `inboundTag` in routing rules, all traffics going through this outbound can be rerouted with routing rules with corresponding inbound tag. + +### How to use? + +If you need to do some more detailed routing for traffics that have been routed by routing rules, like splitting routed traffics to TCP traffics and UDP traffics and send them to different outbounds, this can be done with `loopback` outbound. + +``` jsonc +{ + "outbounds": [ + { + "protocol": "loopback", + "tag": "need-to-split", + "settings": { + "tag": "traffic-input" // This tag will be used as the inboundTag inside the RuleObject + } + }, + { + "tag": "tcp-output", + // protocol, settings, streamSettings etc. + }, + { + "tag": "udp-output", + // protocol, settings, streamSettings etc. + } + ], + "routing": { + "rules": [ + { + "inboundTag": ["traffic-input"], // tag set in the loopback outbound setting + "network": "tcp", + "outboundTag": "tcp-output" + }, + { + "inboundTag": ["traffic-input"], // tag set in the loopback outbound + "network": "udp", + "outboundTag": "udp-output" + } + ] + } +} +``` \ No newline at end of file