Categorygithub.com/database64128/tfo-go/v2
modulepackage
2.2.2
Repository: https://github.com/database64128/tfo-go.git
Documentation: pkg.go.dev

# README

tfo-go

Go Reference Test

tfo-go provides TCP Fast Open support for the net dialer and listener.

go get github.com/database64128/tfo-go/v2

Windows support with Go 1.23 and later

tfo-go's Windows support requires extensive usage of //go:linkname to access Go runtime internals, as there's currently no public API for Windows async IO in the standard library. Unfortunately, the Go team has decided to lock down future uses of linkname, starting with Go 1.23. And our bid to get the linknames we need exempted was partially rejected. Therefore, we had to make the following changes:

  • Windows support is gated behind the build tag tfogo_checklinkname0 when building with Go 1.23 and later.
  • With Go 1.21 and 1.22, tfo-go still provides full Windows support, with or without the build tag.
  • With Go 1.23 and later, when the build tag is not specified, tfo-go only supports listen with TFO on Windows. To get full TFO support on Windows, the build tag tfogo_checklinkname0 must be specified along with linker flag -checklinkname=0 to disable the linkname check.

License

MIT

# Functions

Dial is like [net.Dial] but enables TFO whenever possible.
DialTCP is like [net.DialTCP] but enables TFO whenever possible.
DialTimeout is like [net.DialTimeout] but enables TFO whenever possible.
Listen is like [net.Listen] but enables TFO whenever possible.
ListenContext is like [net.ListenContext] but enables TFO whenever possible.
ListenTCP is like [net.ListenTCP] but enables TFO whenever possible.
SetTFODialer enables TCP Fast Open on the dialer.
SetTFOListener enables TCP Fast Open on the listener.
SetTFOListenerWithBacklog enables TCP Fast Open on the listener with the given backlog.

# Constants

TCPFastopenQueueLength is the maximum number of total pending TFO connection requests, see https://datatracker.ietf.org/doc/html/rfc7413#section-5.1 for why this limit exists.

# Variables

No description provided by the author

# Structs

Dialer wraps [net.Dialer] with an additional option that allows you to disable TFO.
ListenConfig wraps [net.ListenConfig] with TFO-related options.
PlatformUnsupportedError is returned when tfo-go does not support TCP Fast Open on the current platform.