mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-12-24 13:27:56 +08:00
close #237, add linux bbr
This commit is contained in:
@@ -27,6 +27,8 @@ users = [ {user = "a684455c-b14f-11ea-bf0d-42010aaa0004"} , {user = "a684455c-b1
|
||||
|
||||
# extra.tls_rejectUnknownSni = true # 这个开启了的话,防御效果更佳, 不过, 这要求你有真实证书
|
||||
|
||||
#sockopt.bbr = true #用户空间的bbr拥塞控制, 仅限linux, see issue #237
|
||||
|
||||
[[listen]]
|
||||
tag = "my_ws1"
|
||||
protocol = "vlesss"
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
type Sockopt struct {
|
||||
TProxy bool `toml:"tproxy"` //only linux
|
||||
Somark int `toml:"mark"` //only linux
|
||||
BBR bool `toml:"bbr"` //only linux
|
||||
Device string `toml:"device"`
|
||||
|
||||
//fastopen 不予支持, 因为自己客户端在重重网关之下,不可能让层层网关都支持tcp fast open;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package netLayer
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sys/unix"
|
||||
"syscall"
|
||||
|
||||
"github.com/e1732a364fed/v2ray_simple/utils"
|
||||
)
|
||||
@@ -29,6 +30,14 @@ func SetSockOpt(fd int, sockopt *Sockopt, isudp bool, isipv6 bool) {
|
||||
bindToDevice(fd, sockopt.Device)
|
||||
}
|
||||
|
||||
if sockopt.BBR {
|
||||
if err := syscall.SetsockoptString(fd, syscall.SOL_TCP, syscall.TCP_CONGESTION, "bbr"); err != nil {
|
||||
if ce := utils.CanLogErr("bbr failed"); ce != nil {
|
||||
ce.Write(zap.Error(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func bindToDevice(fd int, device string) {
|
||||
|
||||
Reference in New Issue
Block a user