https://github.com/database64128/tfo-go
TCP Fast Open support for Go.
https://github.com/database64128/tfo-go
go golang tcp-fastopen
Last synced: about 1 year ago
JSON representation
TCP Fast Open support for Go.
- Host: GitHub
- URL: https://github.com/database64128/tfo-go
- Owner: database64128
- License: mit
- Created: 2021-10-26T07:56:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-08T02:37:58.000Z (about 1 year ago)
- Last Synced: 2025-03-31T14:11:27.235Z (about 1 year ago)
- Topics: go, golang, tcp-fastopen
- Language: Go
- Homepage:
- Size: 210 KB
- Stars: 34
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `tfo-go`
[](https://pkg.go.dev/github.com/database64128/tfo-go/v2)
[](https://github.com/database64128/tfo-go/actions/workflows/test.yml)
`tfo-go` provides TCP Fast Open support for the `net` dialer and listener.
```bash
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](https://github.com/golang/go/issues/67401), starting with Go 1.23. And our bid to get the linknames we need exempted was [partially rejected](https://github.com/golang/go/issues/67401#issuecomment-2126175774). 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](LICENSE)