github.com/metacubex/tfo-go@v0.0.0-20240228025757-be1269474a66/sockopt.go (about) 1 package tfo 2 3 // SetTFOListener enables TCP Fast Open on the listener. 4 // On platforms where a backlog argument is required, Go std's listen(2) backlog is used. 5 // To specify a custom backlog, use [SetTFOListenerWithBacklog]. 6 func SetTFOListener(fd uintptr) error { 7 return setTFOListener(fd) // sockopt_linux.go, sockopt_listen_generic.go, sockopt_stub.go 8 } 9 10 // SetTFOListenerWithBacklog enables TCP Fast Open on the listener with the given backlog. 11 // If the platform does not support custom backlog, the specified backlog is ignored. 12 func SetTFOListenerWithBacklog(fd uintptr, backlog int) error { 13 return setTFOListenerWithBacklog(fd, backlog) // sockopt_linux.go, sockopt_listen_generic.go, sockopt_stub.go 14 } 15 16 // SetTFODialer enables TCP Fast Open on the dialer. 17 func SetTFODialer(fd uintptr) error { 18 return setTFODialer(fd) // sockopt_darwin.go, sockopt_linux.go, sockopt_connect_generic.go, sockopt_stub.go 19 }