Skip to content
/ limiter Public

A lock free implementation of the Token Bucket rate limiting algorithm.

License

Notifications You must be signed in to change notification settings

rhinof/limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

limiter

A lock free implementation of the Token Bucket rate limiting algorithm.

Usage

    //max # of bytes/s to allow
	maxThroughput := 1000
	// wrapped io.Writer interface
	writer := getWriter()	
	limiter := limiter.NewLimiter(writer, maxThroughput)
	buffer := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	n, err := limiter.Write(buffer)
	fmt.Printf("written %d bytes to wrapped stream - err: %v", n, err)

License

Licensed under the MIT License

About

A lock free implementation of the Token Bucket rate limiting algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages