Documentation ¶
Overview ¶
Package overloader is a plugin to protect teleport from overload.
Index ¶
- type HandlerLimit
- type LimitConfig
- type Overloader
- func (o *Overloader) LimitConfig() LimitConfig
- func (o *Overloader) Name() string
- func (o *Overloader) PostAccept(_ tp.PreSession) *tp.Status
- func (o *Overloader) PostDial(sess tp.PreSession, isRedial bool) *tp.Status
- func (o *Overloader) PostDisconnect(_ tp.BaseSession) *tp.Status
- func (o *Overloader) PostReadCallHeader(ctx tp.ReadCtx) *tp.Status
- func (o *Overloader) PostReadPushHeader(ctx tp.ReadCtx) *tp.Status
- func (o *Overloader) Update(newLimitConfig LimitConfig)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerLimit ¶
HandlerLimit handler QPS overload limitation condition
type LimitConfig ¶
type LimitConfig struct { MaxConn int32 QPSInterval time.Duration MaxTotalQPS int32 MaxHandlerQPS []HandlerLimit }
LimitConfig overload limitation condition
type Overloader ¶
type Overloader struct {
// contains filtered or unexported fields
}
Overloader plug-in to protect teleport from overload
func New ¶
func New(initLimitConfig LimitConfig) *Overloader
New creates a plug-in to protect teleport from overload.
func (*Overloader) LimitConfig ¶
func (o *Overloader) LimitConfig() LimitConfig
LimitConfig returns the overload limitation condition.
func (*Overloader) PostAccept ¶
func (o *Overloader) PostAccept(_ tp.PreSession) *tp.Status
PostAccept checks connection overload. If overload, print error log and close the connection.
func (*Overloader) PostDial ¶
func (o *Overloader) PostDial(sess tp.PreSession, isRedial bool) *tp.Status
PostDial checks connection overload. If overload, print error log and close the connection.
func (*Overloader) PostDisconnect ¶
func (o *Overloader) PostDisconnect(_ tp.BaseSession) *tp.Status
PostDisconnect releases connection count.
func (*Overloader) PostReadCallHeader ¶
func (o *Overloader) PostReadCallHeader(ctx tp.ReadCtx) *tp.Status
PostReadCallHeader checks PULL QPS overload. If overload, print error log and reply error.
func (*Overloader) PostReadPushHeader ¶
func (o *Overloader) PostReadPushHeader(ctx tp.ReadCtx) *tp.Status
PostReadPushHeader checks PUSH QPS overload. If overload, print warning log.
func (*Overloader) Update ¶
func (o *Overloader) Update(newLimitConfig LimitConfig)
Update updates the overload limitation condition.