responder

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidToken = dht.Error{
	Code: dht.ErrorCodeProtocolError,
	Msg:  "invalid token",
}
View Source
var ErrMethodUnknown = dht.Error{
	Code: dht.ErrorCodeMethodUnknown,
	Msg:  "method Unknown",
}
View Source
var ErrMissingArguments = dht.Error{
	Code: dht.ErrorCodeProtocolError,
	Msg:  "missing arguments",
}
View Source
var ErrTooManyRequests = dht.Error{
	Code: dht.ErrorCodeGenericError,
	Msg:  "too many requests",
}

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	Allow(addr netip.Addr) bool
}

func NewLimiter

func NewLimiter(
	overallRate rate.Limit,
	overallBurst int,
	perIpRate rate.Limit,
	perIpBurst int,
	perIpSize int,
	perIpTtl time.Duration,
) Limiter

type Params

type Params struct {
	fx.In
	KTable          ktable.Table
	DiscoveredNodes concurrency.BatchingChannel[ktable.Node] `name:"dht_discovered_nodes"`
	Logger          *zap.SugaredLogger
}

type Responder

type Responder interface {
	Respond(context.Context, dht.RecvMsg) (dht.Return, error)
}

type Result

type Result struct {
	fx.Out
	Responder         Responder
	QueryDuration     prometheus.Collector `group:"prometheus_collectors"`
	QuerySuccessTotal prometheus.Collector `group:"prometheus_collectors"`
	QueryErrorTotal   prometheus.Collector `group:"prometheus_collectors"`
	QueryConcurrency  prometheus.Collector `group:"prometheus_collectors"`
}

func New

func New(p Params) Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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