github.com/peterdeka/grab@v2.0.0+incompatible/rate_limiter.go (about)

     1  package grab
     2  
     3  import "context"
     4  
     5  // RateLimiter is an interface that must be satisfied by any third-party rate
     6  // limiters that may be used to limit download transfer speeds.
     7  //
     8  // A recommended token bucket implementation can be found at
     9  // https://godoc.org/golang.org/x/time/rate#Limiter.
    10  type RateLimiter interface {
    11  	WaitN(ctx context.Context, n int) (err error)
    12  }