|
|
|
@ -13,11 +13,11 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|
|
|
|
if strings.HasPrefix(network, "tcp") {
|
|
|
|
|
switch config.Tfo {
|
|
|
|
|
case SocketConfig_Enable:
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
|
|
|
|
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
case SocketConfig_Disable:
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
|
|
|
|
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -30,11 +30,11 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|
|
|
|
if strings.HasPrefix(network, "tcp") {
|
|
|
|
|
switch config.Tfo {
|
|
|
|
|
case SocketConfig_Enable:
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
|
|
|
|
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
case SocketConfig_Disable:
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
|
|
|
|
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|