mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Add tcpMaxSeg
to sockopt
(#2002)
This commit is contained in:
parent
18e5b0963f
commit
dd81ad5342
4 changed files with 29 additions and 2 deletions
|
@ -94,6 +94,13 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||
return newError("failed to set TCP_USER_TIMEOUT", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpMaxSeg > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_MAXSEG, int(config.TcpMaxSeg)); err != nil {
|
||||
return newError("failed to set TCP_MAXSEG", err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
@ -156,6 +163,12 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|||
return newError("failed to set TCP_USER_TIMEOUT", err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.TcpMaxSeg > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_MAXSEG, int(config.TcpMaxSeg)); err != nil {
|
||||
return newError("failed to set TCP_MAXSEG", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue