github.com/database64128/tfo-go/v2@v2.2.0/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 backlog is 0, Go std's listen(2) backlog is used.
    12  // If the platform does not support custom backlog values, the given backlog is ignored.
    13  func SetTFOListenerWithBacklog(fd uintptr, backlog int) error {
    14  	return setTFOListenerWithBacklog(fd, backlog) // sockopt_linux.go, sockopt_listen_generic.go, sockopt_stub.go
    15  }
    16  
    17  // SetTFODialer enables TCP Fast Open on the dialer.
    18  func SetTFODialer(fd uintptr) error {
    19  	return setTFODialer(fd) // sockopt_darwin.go, sockopt_linux.go, sockopt_connect_generic.go, sockopt_stub.go
    20  }