Skip to content

Commit

Permalink
Upgrade to actions/setup-go@v5, improve README (#38)
Browse files Browse the repository at this point in the history
* Upgrade to actions/setup-go@v5

* Improve README
  • Loading branch information
VojtechVitek authored Jul 25, 2024
1 parent 4afd620 commit 05a79e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ^1.22
id: go
go-version: ^1.17

- name: Git clone (master)
uses: actions/checkout@v4
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ^1.14
id: go
go-version: ^1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v4
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# httprate
# httprate - HTTP Rate Limiter

![](https://github.com/go-chi/httprate/workflows/build/badge.svg?branch=master)
![CI workflow](https://github.com/go-chi/httprate/actions/workflows/ci.yml/badge.svg)
![Benchmark workflow](https://github.com/go-chi/httprate/actions/workflows/benchmark.yml/badge.svg)
[![GoDoc Widget]][GoDoc]

net/http request rate limiter based on the Sliding Window Counter pattern inspired by
CloudFlare https://blog.cloudflare.com/counting-things-a-lot-of-different-things/.
[GoDoc]: https://pkg.go.dev/github.com/go-chi/httprate
[GoDoc Widget]: https://godoc.org/github.com/go-chi/httprate?status.svg

`net/http` request rate limiter based on the Sliding Window Counter pattern inspired by
CloudFlare https://blog.cloudflare.com/counting-things-a-lot-of-different-things.

The sliding window counter pattern is accurate, smooths traffic and offers a simple counter
design to share a rate-limit among a cluster of servers. For example, if you'd like
to use redis to coordinate a rate-limit across a group of microservices you just need
to implement the httprate.LimitCounter interface to support an atomic increment
and get.
to implement the `httprate.LimitCounter` interface to support an atomic increment and get.

## Backends

- [x] In-memory (built into this package)
- [x] Redis: https://github.com/go-chi/httprate-redis

## Example

Expand Down Expand Up @@ -108,11 +116,6 @@ r.Use(httprate.Limit(
))
```

## Related packages

Redis backend for httprate: https://github.com/go-chi/httprate-redis


## LICENSE

MIT

0 comments on commit 05a79e9

Please sign in to comment.