ratelimit

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport added in v0.1.3

type Transport struct {
	Next    http.RoundTripper
	Options *TransportOptions
	// contains filtered or unexported fields
}

Transport implements http.RoundTripper

It serves as a wrapper for requests, which implements caching of responses and rate limiting total amount of requests/s

func NewTransport added in v0.1.3

func NewTransport(next http.RoundTripper, options *TransportOptions) *Transport

NewRatelimitTransport initializes a new *ratelimitTransport instance

func (*Transport) RoundTrip added in v0.1.3

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper

type TransportOptions added in v0.1.3

type TransportOptions struct {
	RatelimitEnabled bool
	RatelimitRPS     int
	CacheExpiresTime time.Duration
	CacheCleanupTime time.Duration
	CacheEnabled     bool
}

TransportOptions are options for Transport

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL