Skip to content

devnw/bridgekeeper

Bridgekeeper - What is your (Re)Quest?

Build & Test Go Report Card codecov GoDoc License PRs Welcome

Bridgekeeper is a request throttler for http.Client

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.

Using Bridgekeeper

go get -u go.devnw.com/bk@latest

Example

    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"))

Client Interface

Bridgekeeper implements the interface shown below

type Client interface {
    Do(request *http.Request) (*http.Response, error)
}

This interface is also implemented by http.Client.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors