Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLimiter ¶ added in v0.8.4
func NewLimiter(count int) grpc_ratelimit.Limiter
NewLimiter return new go-grpc Limiter, specified the number of requests you want to limit as a counts per second.
func NewRateLimitedTransport ¶
func NewRateLimitedTransport(transport http.RoundTripper, limiter *rate.Limiter) http.RoundTripper
NewRateLimitedTransport creates a new RateLimitedTransport that wraps the provided http.RoundTripper and uses the provided rate.Limiter to control the rate of outgoing requests. It returns an http.RoundTripper that can be used wherever an http.RoundTripper is expected.
Parameters:
- transport: The underlying http.RoundTripper to wrap. This is typically an instance of http.Transport or any custom implementation of http.RoundTripper.
- limiter: The rate.Limiter to use for controlling the rate of outgoing requests.
func UnaryClientInterceptor ¶ added in v0.8.4
func UnaryClientInterceptor(limiter grpc_ratelimit.Limiter) grpc.UnaryClientInterceptor
UnaryClientInterceptor return server unary interceptor that limit requests.
Types ¶
type RateLimitedTransport ¶
type RateLimitedTransport struct { Transport http.RoundTripper Limiter *rate.Limiter }
RateLimitedTransport is a wrapper around http.RoundTripper that adds rate limiting functionality to HTTP requests. It uses a rate.Limiter to control the rate of outgoing requests.