12345678910111213141516171819202122232425 |
- //go:build unix
- package dialer
- import (
- "context"
- "net"
- "github.com/metacubex/tfo-go"
- )
- const DisableTFO = false
- func dialTFO(ctx context.Context, netDialer net.Dialer, network, address string) (net.Conn, error) {
- ctx, cancel := context.WithTimeout(context.Background(), DefaultTCPTimeout)
- dialer := tfo.Dialer{Dialer: netDialer, DisableTFO: false}
- return &tfoConn{
- dialed: make(chan bool, 1),
- cancel: cancel,
- ctx: ctx,
- dialFn: func(ctx context.Context, earlyData []byte) (net.Conn, error) {
- return dialer.DialContext(ctx, network, address, earlyData)
- },
- }, nil
- }
|