shaper

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shaper

type Shaper struct {
	// MaxSessions represens maximum sessions count.
	MaxSessions int
	// contains filtered or unexported fields
}

Shaper represents a connection traffic constraint set.

func New

func New(maxSessions int, rateLimit int, burst int, jidMatcher stringmatcher.Matcher) Shaper

New returns a new Shaper given a configuration.

func (*Shaper) RateLimiter

func (s *Shaper) RateLimiter() *rate.Limiter

RateLimiter returns a new rate limiter configured with shaper parameters.

type Shapers

type Shapers []Shaper

Shapers represents a shaper collection ordered by priority.

func (Shapers) DefaultC2S

func (ss Shapers) DefaultC2S() *Shaper

DefaultC2S returns C2S default shaper.

func (Shapers) DefaultS2S

func (ss Shapers) DefaultS2S() *Shaper

DefaultS2S returns S2S default shaper.

func (Shapers) MatchingJID

func (ss Shapers) MatchingJID(j *jid.JID) *Shaper

MatchingJID returns the shaper that should be applied to a given JID.

Jump to

Keyboard shortcuts

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