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

添加 loopback 出站文档内容 #477

Merged
merged 3 commits into from
Mar 4, 2024

Conversation

KobeArthurScofield
Copy link
Contributor

功能在 1.5.1 就从 v2fly 那边 port 了,亲测能用但是一直没人写文档以致好像知道的不多 😂

@yuhan6665 yuhan6665 merged commit 17748f2 into XTLS:main Mar 4, 2024
1 check passed
@yuhan6665
Copy link
Member

感谢 主要是不知道有什么用
另外可以试一下加到左侧目录

@KobeArthurScofield
Copy link
Contributor Author

刚刚才找到怎么添加到目录


用例的话,看了下那边的 pr 里面提到

This should work in the same way as you combined dokodemo-door inbound and modded outbound address, with the exception that everything will now happen inside V2Ray.

之前要让已经路由分配过一次的流量再由路由再分配一次的话,配置文件要写一个 dokodemo-door 入站负责监听、一个带有 redirect 选项的 freedom 出站将流量送到 dokodemo-door ,这样的话流量就要从 core 流出再重新流入。

如果使用 loopback 的话,在路由里面引用设定好的 tag 可以直接将流量重新引回来,这样流量也就一直在 core 里面应该可以提高性能,配置文件也可以变得简单。

如果是我自己的用例大概就是:之前的配置文件已经写了一大堆路由规则,有不少走直连的,也有不少走代理的,即使代理出口只有一个,里面包含的条目比较多改起来比较麻烦。但是我现在突然要将走代理出口的流量分开,TCP 走 VLESS,UDP 走 Shadowsocks,没有 loopback 时修改起来会很麻烦也很容易错漏。有了 loopback 只要这样改就好:

{
    "outbounds": [
        {
            "protocol": "loopback",
            "tag": "proxy",
            "settings": {
              "tag": "proxy-data"
            }
        },
        {
            "protocol": "vless",
            "tag": "tcp-proxy",
            // settings, streamSettings, etc.
        },
        {
            "protocol": "shadowsocks",
            "tag": "udp-proxy",
            // settings, streamSettings, etc.
        }
    ],
    "routing": {
        "rules": [
            {
                "inboundTag": ["proxy-data"],
                "network": "tcp",
                "outboundTag": "tcp-proxy"
            },
            {
                "inboundTag": ["proxy-data"],
                "network": "udp",
                "outboundTag": "udp-proxy"
            }
        ]
    }
}

应该比较少见但是的确方便。感觉这个应该附带一个简单的说明用例

@Fangliding
Copy link
Member

多学学人家iptable还可以重路由检查×

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

Successfully merging this pull request may close these issues.

3 participants