mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
add tcpcongestion
(#1234)
* add `tcpcongestion` * Update sockopt_linux.go * Update config.pb.go * Update transport_internet.go * Update config.pb.go * Update transport_internet.go * Update config.proto
This commit is contained in:
parent
43477109f5
commit
8cf23f1947
4 changed files with 17 additions and 0 deletions
|
@ -424,6 +424,7 @@ type SocketConfig struct {
|
|||
DialerProxy string `protobuf:"bytes,9,opt,name=dialer_proxy,json=dialerProxy,proto3" json:"dialer_proxy,omitempty"`
|
||||
TcpKeepAliveInterval int32 `protobuf:"varint,10,opt,name=tcp_keep_alive_interval,json=tcpKeepAliveInterval,proto3" json:"tcp_keep_alive_interval,omitempty"`
|
||||
TcpKeepAliveIdle int32 `protobuf:"varint,11,opt,name=tcp_keep_alive_idle,json=tcpKeepAliveIdle,proto3" json:"tcp_keep_alive_idle,omitempty"`
|
||||
TcpCongestion string `protobuf:"bytes,12,opt,name=tcp_congestion,json=tcpCongestion,proto3 json:"tcp_congestion,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SocketConfig) Reset() {
|
||||
|
|
|
@ -96,4 +96,6 @@ message SocketConfig {
|
|||
int32 tcp_keep_alive_interval = 10;
|
||||
|
||||
int32 tcp_keep_alive_idle = 11;
|
||||
|
||||
string tcp_congestion = 12;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,12 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||
return newError("failed to unset SO_KEEPALIVE", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpCongestion != "" {
|
||||
if err := syscall.SetsockoptString(int(fd), syscall.SOL_TCP, syscall.TCP_CONGESTION, config.TcpCongestion); err != nil {
|
||||
return newError("failed to set TCP_CONGESTION", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
@ -121,6 +127,12 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|||
return newError("failed to unset SO_KEEPALIVE", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpCongestion != "" {
|
||||
if err := syscall.SetsockoptString(int(fd), syscall.SOL_TCP, syscall.TCP_CONGESTION, config.TcpCongestion); err != nil {
|
||||
return newError("failed to set TCP_CONGESTION", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue