boskos/client/client.go
func NewClient(owner string, url string) *Client {

	client := &Client{
		url:     url,
		owner:   owner,
		storage: storage.NewMemoryStorage(),
	}

	// Configure the dialer to attempt three additional times to establish
	// a connection after a failed dial attempt. The dialer should wait 10
	// seconds between each attempt.
	client.Dialer.RetryCount = 3
	client.Dialer.RetrySleep = time.Second * 10

	// Configure the dialer and HTTP client transport to mimic the configuration
	// of the http.DefaultTransport with the exception that the Dialer's Dial
	// and DialContext functions are assigned to the client transport.
	//
	// See https://golang.org/pkg/net/http/#RoundTripper for the values
	// values used for the http.DefaultTransport.
	client.Dialer.Timeout = 30 * time.Second
	client.Dialer.KeepAlive = 30 * time.Second
	client.Dialer.DualStack = true
	client.http.Transport = &http.Transport{
		Proxy:                 http.ProxyFromEnvironment,
		Dial:                  client.Dialer.Dial,
		DialContext:           client.Dialer.DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}

	return client
}
func NewClient(owner string, url string) *Client {

	client := &Client{
		url:     url,
		owner:   owner,
		storage: storage.NewMemoryStorage(),
	}

	// Configure the dialer to attempt three additional times to establish
	// a connection after a failed dial attempt. The dialer should wait 10
	// seconds between each attempt.
	client.Dialer.RetryCount = 3
	client.Dialer.RetrySleep = time.Second * 10

	// Configure the dialer and HTTP client transport to mimic the configuration
	// of the http.DefaultTransport with the exception that the Dialer's Dial
	// and DialContext functions are assigned to the client transport.
	//
	// See https://golang.org/pkg/net/http/#RoundTripper for the values
	// values used for the http.DefaultTransport.
	client.Dialer.Timeout = 30 * time.Second
	client.Dialer.KeepAlive = 30 * time.Second
	client.Dialer.DualStack = true
	client.http.Transport = &http.Transport{
		Proxy:                 http.ProxyFromEnvironment,
		Dial:                  client.Dialer.Dial,
		DialContext:           client.Dialer.DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}

	return client
}
func NewClient ( owner string , url string ) * Client { client := & Client { url : url , owner : owner , storage : storage . NewMemoryStorage ( ) , } // Configure the dialer to attempt three additional times to establish // a connection after a failed dial attempt. The dialer should wait 10 // seconds between each attempt. client . Dialer . RetryCount = 3 client . Dialer . RetrySleep = time . Second * 10 // Configure the dialer and HTTP client transport to mimic the configuration // of the http.DefaultTransport with the exception that the Dialer's Dial // and DialContext functions are assigned to the client transport. // // See https://golang.org/pkg/net/http/#RoundTripper for the values // values used for the http.DefaultTransport. client . Dialer . Timeout = 30 * time . Second client . Dialer . KeepAlive = 30 * time . Second client . Dialer . DualStack = true client . http . Transport = & http . Transport { Proxy : http . ProxyFromEnvironment , Dial : client . Dialer . Dial , DialContext : client . Dialer . DialContext , MaxIdleConns : 100 , IdleConnTimeout : 90 * time . Second , TLSHandshakeTimeout : 10 * time . Second , ExpectContinueTimeout : 1 * time . Second , } return client }
// NewClient creates a Boskos client for the specified URL and resource owner.
//
// Clients created with this function default to retrying failed connection
// attempts three times with a ten second pause between each attempt.
NewClient creates a Boskos client for the specified URL and resource owner . Clients created with this function default to retrying failed connection attempts three times with a ten second pause between each attempt .