package grpc import ( "net" "net/http" "time" "github.com/go-resty/resty/v2" ) var headers = map[string]string{ "Accept": "application/json, text/plain, */*", "Content-Type": "application/json", } var RestyClient = resty.NewWithClient(&http.Client{ Transport: createTransport(nil), }) func createTransport(localAddr net.Addr) *http.Transport { dialer := &net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, } if localAddr != nil { dialer.LocalAddr = localAddr } return &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: dialer.DialContext, MaxIdleConns: 200, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, MaxIdleConnsPerHost: 200, } }