github.com/sagernet/sing-box@v1.9.0-rc.20/common/dialer/tfo_stub.go (about)

     1  //go:build !go1.20
     2  
     3  package dialer
     4  
     5  import (
     6  	"context"
     7  	"net"
     8  
     9  	M "github.com/sagernet/sing/common/metadata"
    10  	N "github.com/sagernet/sing/common/network"
    11  )
    12  
    13  func DialSlowContext(dialer *tcpDialer, ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
    14  	switch N.NetworkName(network) {
    15  	case N.NetworkTCP, N.NetworkUDP:
    16  		return dialer.DialContext(ctx, network, destination.String())
    17  	default:
    18  		return dialer.DialContext(ctx, network, destination.AddrString())
    19  	}
    20  }