Documentation
¶
Index ¶
Constants ¶
const DefaultQueueingTimeout = 10 * time.Second
DefaultQueueingTimeout is the default timeout for queueing the request.
Variables ¶
var ErrConnectionQueueingTimeout = errors.New("rateLimitingTransport: queueing timeout")
ErrConnectionQueueingTimeout indicates that we've exceeded the time allocated for queueing the current request before the request attempt could be made.
Functions ¶
This section is empty.
Types ¶
type ConnectionTimeStore ¶
type ConnectionTimeStore interface {
GetConnectionWaitTime(addrOrPeerID string) (bool, time.Duration, time.Time)
UpdateConnectionTime(addrOrPeerID string, provisionalTime time.Time) bool
}
ConnectionTimeStore is a subset of the phonebook that is used to store the connection times.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer establish tcp-level connection with the destination
func MakeRateLimitingDialer ¶
func MakeRateLimitingDialer(phonebook phonebook.Phonebook, resolver dnssec.ResolverIf) Dialer
MakeRateLimitingDialer creates a rate limiting dialer that would limit the connections according to the entries in the phonebook.
type RateLimitingBoundTransport ¶
type RateLimitingBoundTransport struct {
// contains filtered or unexported fields
}
RateLimitingBoundTransport is the transport for execute a single HTTP transaction, obtaining the Response for a given Request.
func MakeRateLimitingBoundTransport ¶
func MakeRateLimitingBoundTransport(phonebook ConnectionTimeStore, queueingTimeout time.Duration, dialer *Dialer, maxIdleConnsPerHost int, target string) RateLimitingBoundTransport
MakeRateLimitingBoundTransport creates a rate limiting http transport that that: 1. would limit the requests rate according to the entries in the phonebook. 2. is bound to a specific target.
func MakeRateLimitingBoundTransportWithRoundTripper ¶
func MakeRateLimitingBoundTransportWithRoundTripper(phonebook ConnectionTimeStore, queueingTimeout time.Duration, rt http.RoundTripper, target string) RateLimitingBoundTransport
MakeRateLimitingBoundTransportWithRoundTripper creates a rate limiting http transport that: 1. would limit the requests rate according to the entries in the phonebook. 2. is bound to a specific target.