mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 11:29:36 +03:00
Add tcpWindowClamp
to sockopt
(#1757)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
@ -46,7 +46,7 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
||||
return newError("failed to set SO_MARK").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if config.Interface != "" {
|
||||
if err := syscall.BindToDevice(int(fd), config.Interface); err != nil {
|
||||
return newError("failed to set Interface").Base(err)
|
||||
@ -89,6 +89,12 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
||||
return newError("failed to set TCP_CONGESTION", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpWindowClamp > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
@ -139,6 +145,12 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
||||
return newError("failed to set TCP_CONGESTION", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpWindowClamp > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
Reference in New Issue
Block a user