github.com/0chain/gosdk@v1.17.11/core/util/transport.go (about)

     1  //go:build !js && !wasm
     2  // +build !js,!wasm
     3  
     4  package util
     5  
     6  import (
     7  	"net"
     8  	"net/http"
     9  	"time"
    10  )
    11  
    12  // Run the HTTP request in a goroutine and pass the response to f.
    13  var transport = &http.Transport{
    14  	Proxy:                 http.ProxyFromEnvironment,
    15  	MaxIdleConns:          1000,
    16  	IdleConnTimeout:       90 * time.Second,
    17  	TLSHandshakeTimeout:   10 * time.Second,
    18  	ExpectContinueTimeout: 1 * time.Second,
    19  	MaxIdleConnsPerHost:   5,
    20  	ForceAttemptHTTP2:     true,
    21  
    22  	DialContext: (&net.Dialer{
    23  		Timeout:   30 * time.Second,
    24  		KeepAlive: 30 * time.Second,
    25  		DualStack: true,
    26  	}).DialContext,
    27  }