Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSRL

it contains two types bucket : traffic shaping and rate limit.

Tsrl flow

How to use

  // first access a new buckets pool to manage the buckets

  pool := New()
  // get a bucket ,if not exists ,program will create a new bucket ,put it into pool and return

  bucket := pool.AddBucket("hello", 500, 5*time.Second,model.BUCKET_TYPE_TRAFFIC_SHAPING)

  // get the token from bucket and do your job

  token, err := bucket.BorrowToken("key")

  // when finish your job ,you should release the token

  bucket.ReleaseToken(token)

About

HTTP Traffic Shaping / Rate Limit,achieved with golang

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages