package ratelimit import "testing" func TestAllowBurstThenBlock(t *testing.T) { l := New(2) if !l.Allow("203.0.113.10") { t.Fatal("first") } if !l.Allow("203.0.113.10") { t.Fatal("burst") } if l.Allow("203.0.113.10") { t.Fatal("over burst") } if !l.Allow("198.51.100.20") { t.Fatal("other ip") } }