Bridgekeeper replaces the hard implementation of http.Client with an
implementation of a shared interface such that anything implementing the
bk.Client interface can use Bridgekeeper to throttle API requests through
configuration.
go get -u go.devnw.com/bk@latest client := bk.New(
ctx, // Your application context
http.DefaultClient, // Your HTTP Client
time.Millisecond, // Delay between requests
5, // Retry count
10, // Concurrent request limit
http.DefaultClient.Timeout, // Request timeout
)
resp, err := client.Do(http.NewRequest(http.MethodGet, "localhost:5555"))Bridgekeeper implements the interface shown below
type Client interface {
Do(request *http.Request) (*http.Response, error)
}This interface is also implemented by http.Client.