rate-limiting-http

command
v0.69.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

HTTP Rate Limiting

This example demonstrates per-principal HTTP rate limiting.

Running the Example

go run github.com/dioad/net/examples/rate-limiting-http

Or build and run:

cd examples/rate-limiting-http
go build
./rate-limiting-http

Then test by making multiple quick requests:

for i in {1..10}; do curl http://localhost:8080/limited; done

What It Demonstrates

  • Creating a rate limiter with requests per second and burst limits
  • Using rate limiting as middleware for specific principals
  • Protecting HTTP handlers with rate limits
  • Observing rate limiting in action with rapid requests

Code

See main.go for the complete executable example.

Documentation

Overview

Package main demonstrates rate limiting an HTTP server with static, per-principal limits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL