github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/inbound/default_tcp_go1.20.go (about)

     1  //go:build go1.20
     2  
     3  package inbound
     4  
     5  import (
     6  	"context"
     7  	"net"
     8  
     9  	"github.com/sagernet/tfo-go"
    10  )
    11  
    12  const go120Available = true
    13  
    14  func listenTFO(listenConfig net.ListenConfig, ctx context.Context, network string, address string) (net.Listener, error) {
    15  	var tfoConfig tfo.ListenConfig
    16  	tfoConfig.ListenConfig = listenConfig
    17  	return tfoConfig.Listen(ctx, network, address)
    18  }