Documentation ¶
Overview ¶
Package limiter provides a rate limiting mechanism for RFQs to protect against reorgs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LatestBlockFetcher ¶
type LatestBlockFetcher interface { // LatestBlock returns the latest block number. LatestBlock() uint64 }
LatestBlockFetcher is the interface for fetching the latest block number.
type Limiter ¶
type Limiter interface { // IsAllowed returns true if the request is allowed, false otherwise. IsAllowed(ctx context.Context, request *reldb.QuoteRequest) (bool, error) }
Limiter is the interface for rate limiting RFQs.
func NewRateLimiter ¶
func NewRateLimiter( cfg relconfig.Config, l LatestBlockFetcher, q quoter.Quoter, metricHandler metrics.Handler, tokens map[string]relconfig.TokenConfig, ) Limiter
NewRateLimiter creates a new Limiter. TODO: implement the sliding window: queue up requests and process them in order if cumulative volume is above limit.
Click to show internal directories.
Click to hide internal directories.