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

添加 TCP Brutal 示例 #69

Closed
tobyxdd opened this issue Nov 6, 2023 · 17 comments
Closed

添加 TCP Brutal 示例 #69

tobyxdd opened this issue Nov 6, 2023 · 17 comments

Comments

@tobyxdd
Copy link

tobyxdd commented Nov 6, 2023

https://github.com/apernet/tcp-brutal/

https://sing-box.sagernet.org/zh/configuration/shared/tcp-brutal/

@chika0801
Copy link
Owner

感谢大佬建议,不更了,晚点删库跑路,反正起初是自用

@chika0801
Copy link
Owner

VPS是DD的Debian11 Linux debian 5.10.0-26-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64 GNU/Linux

使用 bash <(curl -fsSL https://tcp.hy2.sh/) 安装好 tcp-brutal

编译sing-box(版本 Revision: c34556759c606e2de2a36293b4e7159289ccbac6)

服务端配置

{
    "inbounds": [
        {
            "type": "vless",
            "listen": "::",
            "listen_port": 443,
            "users": [
                {
                    "uuid": "chika",
                    "flow": ""
                }
            ],
            "tls": {
                "enabled": true,
                "certificate_path": "/root/fullchain.cer",
                "key_path": "/root/private.key"
            },
            "multiplex": {
                "enabled": true,
                "padding": false,
                "brutal": { // experimental
                    "enabled": true,
                    "up_mbps": 50,
                    "down_mbps": 20
                }
            }
        }
    ],
    "outbounds": [
        {
            "type": "direct"
        }
    ]
}

客户端出站部分配置

        {
            "tag": "proxy",
            "type": "vless",
            "server": "VPS的IP",
            "server_port": 443,
            "uuid": "chika",
            "flow": "",
            "tls": {
                "enabled": true,
                "server_name": "loveliveXXX.top",
                "utls": {
                    "enabled": true,
                    "fingerprint": "chrome"
                }
             },
            "packet_encoding": "xudp",
            "multiplex": {
                "enabled": true,
                "protocol": "h2mux",
                "max_connections": 4,
                "min_streams": 4,
                "padding": false
            }
        },

客户端访问speedtest.net测速,发现 "up_mbps": 50, 实际没有生效。我就放弃了。

@chika0801
Copy link
Owner

今天测试发现是 客户端出站部分配置 中

            "multiplex": {
                "enabled": true,
                "protocol": "h2mux",
                "max_connections": 4,
                "min_streams": 4,
                "padding": false
            }

改为

            "multiplex": {
                "enabled": true,
                "protocol": "h2mux",
                "max_connections": 4,
                "min_streams": 4,
                "padding": false,
                "brutal": {
                    "enabled": true,
                    "up_mbps": 50,
                    "down_mbps": 500
                }
            }

为什么回复您时,我没有加?我在开始测试时,用当时代码编译后的文件,客户端加了brutal报错无法启动,删除才能启动。

现在,客户端是win11,必须要有 brutal 字段参数,enabled为true,up_mbps和down_mbps随便填,肯定不会有效。

此时服务端配置中的 up_mbps 体现在客户端测速时的下行速率。客户端上行是你本地上行的速率。

@chika0801
Copy link
Owner

已更新了readme

@tobyxdd
Copy link
Author

tobyxdd commented Nov 9, 2023

Max connections 是不是应该设置为 1?否则会有多个连接吗 我也不是很清楚 singbox 这块

@chika0801
Copy link
Owner

另外需要注意的是,sockopt 设置的是每个连接的速度。这意味着其只适用于支持多路复用(mux)的协议,因为多路复用让客户端可以将所有代理连接整合到一个 TCP 连接中传输。 对于需要为每个代理连接单独建立连接的协议,当同时有多个连接活跃时,使用 TCP Brutal 会导致总发送速率超过所设置的上限。

我当时看到你这段话,没理解到。经你这样提醒,我也去看了下 Max connections 参数文档的解释。我认同你的看法。不过我不是专业的,这问题我不能肯定。也许哪天sing-box群有人提问和回答。

我先将readme中的内容改了。

@chika0801
Copy link
Owner

chika0801 commented Nov 10, 2023

"max_connections": 4,
"min_streams": 4,

我昨天测试时 max_connections 4,服务端上行限制是填10,客户端win11,浏览器测speedtest网页版,下行结果就是在10以内并没超,有空我再实操研究一下。看代码和理论方面我不会(懂)。

update:复测的结果同上。

@chika0801 chika0801 reopened this Nov 10, 2023
@Ley-VN
Copy link

Ley-VN commented Nov 14, 2023

Configuration with brutal still uses normal tun?
How to determine vps speed and set appropriate parameters

@chika0801
Copy link
Owner

Configuration with brutal still uses normal tun? How to determine vps speed and set appropriate parameters

"This parameter is used in server-side configuration.

Typically, your server configuration does not use the 'tun' mode.

Regarding the value in the server configuration, in general scenarios, I believe a good range is around 100Mbps or smaller."

@Ley-VN
Copy link

Ley-VN commented Nov 14, 2023

I mean the client. Still using your tun configuration, right?

@chika0801
Copy link
Owner

I mean the client. Still using your tun configuration, right?

There is no correlation between the client configuration file about it and whether you use tun mode in your inbound configuration.
The client configuration corresponds to the outbound part, which requires those parameter contents shown in the example to take effect.
If your client is a linux system and has its kernel module installed, then the upstream rate (as opposed to the server which is the downstream rate of the server) filled in your client configuration parameters will take effect. But usually the client's uplink rate is not a priority. In mainland China, the network state, is the need for the client's downlink speed is good. (i.e. server-side uplink speed, so you just need to linux system on the server side, and installed its kernel module, it will take effect)

@Ley-VN
Copy link

Ley-VN commented Nov 15, 2023

WARN: Now this script is using systemd's "Drop-In file",
WARN: DO NOT override any systemd service file,
WARN: YOU MUST put your custom systemd service config in to the Drop-In file folder
WARN: "/etc/systemd/system/sing-box.service.d" and "/etc/systemd/system/sing-box@.service.d"
WARN: You can read "10-donot_touch.conf" in the folder above for more information.
Error installation script

@chika0801
Copy link
Owner

WARN: Now this script is using systemd's "Drop-In file", WARN: DO NOT override any systemd service file, WARN: YOU MUST put your custom systemd service config in to the Drop-In file folder WARN: "/etc/systemd/system/sing-box.service.d" and "/etc/systemd/system/sing-box@.service.d" WARN: You can read "10-donot_touch.conf" in the folder above for more information. Error installation script

I can't help you with this information you have. You should rely on yourself to be self aware of some basics and try them out. This kind of hand-holding beginners and answering questions try is usually not liked by authors.

@chise0713
Copy link
Contributor

WARN: Now this script is using systemd's "Drop-In file", WARN: DO NOT override any systemd service file, WARN: YOU MUST put your custom systemd service config in to the Drop-In file folder WARN: "/etc/systemd/system/sing-box.service.d" and "/etc/systemd/system/sing-box@.service.d" WARN: You can read "10-donot_touch.conf" in the folder above for more information. Error installation script

Not an error, this is a reminder. Remind that if you needed to edit service file, put your custom conf into drop-in file directory.

@chika0801
Copy link
Owner

@tobyxdd

请教一下,我通过这个表格展示信息

Multiplex UDP relay mode 拥塞控制算法
Hysteria 自带 Brutal
Hysteria2 自带 Brutal / BBR
TUIC 自带 native / quic / udp_over_stream BBR

Hysteria 1 / 2 在 UDP relay mode 中,填写什么单词比较恰当一点了?

@tobyxdd
Copy link
Author

tobyxdd commented Dec 3, 2023

@tobyxdd

请教一下,我通过这个表格展示信息

Multiplex UDP relay mode 拥塞控制算法
Hysteria 自带 Brutal
Hysteria2 自带 Brutal / BBR
TUIC 自带 native / quic / udp_over_stream BBR

Hysteria 1 / 2 在 UDP relay mode 中,填写什么单词比较恰当一点了?

都是 native

@chika0801
Copy link
Owner

这个问题我在群里反应过了,目前TCP-brutal里的mux调不了connection,默认只能1

你猜 hy 有几个 quic 连接

也是1个

我是想充分利用下TCP mux,可开多个TCP隧道,这样就不至于all in boom。(TCP没有连接迁移

那你帮 hy 实现一下在多个 TCP 连接之间共享一个网速?

不要想当然了

不能多个TCP隧道多个独立拥塞控制吗

设置网速一共是 100M,多个怎么独立控制

这种问题怎么从你嘴巴里说出来

是我无知了,大佬别生气

这是群友转的内容。看后我也认为在sing-box中,无论用户把 "max_connections": 4, 这里填几,实际效果是1。也许大佬你有空可以看看sing-box中相关的代码。

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

No branches or pull requests

4 participants