github.com/metacubex/tfo-go@v0.0.0-20240228025757-be1269474a66/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 }