github.com/sagernet/tfo-go@v0.0.0-20231209031829-7b5343ac1dc6/sockopt_darwin.go (about)

     1  package tfo
     2  
     3  import "golang.org/x/sys/unix"
     4  
     5  const TCP_FASTOPEN_FORCE_ENABLE = 0x218
     6  
     7  // setTFOForceEnable disables the Darwin kernel's brutal TFO backoff mechanism.
     8  func setTFOForceEnable(fd uintptr) error {
     9  	return unix.SetsockoptInt(int(fd), unix.IPPROTO_TCP, TCP_FASTOPEN_FORCE_ENABLE, 1)
    10  }
    11  
    12  func setTFODialer(fd uintptr) error {
    13  	return setTFOForceEnable(fd)
    14  }