server

package
v0.10.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port         uint16
	QueryTimeout time.Duration
}

func NewDefaultConfig

func NewDefaultConfig() Config

type IdIssuer

type IdIssuer interface {
	Issue() string
}

type LastResponses

type LastResponses struct {
	StartTime    time.Time
	LastSuccess  time.Time
	LastResponse time.Time
}

type Params

type Params struct {
	fx.In
	Config    Config
	Responder responder.Responder
	Logger    *zap.SugaredLogger
}

type Result

type Result struct {
	fx.Out
	Server            lazy.Lazy[Server]
	LastResponses     *concurrency.AtomicValue[LastResponses] `name:"dht_server_last_responses"`
	AppHook           fx.Hook                                 `group:"app_hooks"`
	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

type Server

type Server interface {
	Query(ctx context.Context, addr netip.AddrPort, q string, args dht.MsgArgs) (dht.RecvMsg, error)
	// contains filtered or unexported methods
}

type Socket

type Socket interface {
	Open(localAddr netip.AddrPort) error
	Close() error
	Send(netip.AddrPort, []byte) error
	Receive([]byte) (int, netip.AddrPort, error)
}

func NewSocket

func NewSocket() Socket

Jump to

Keyboard shortcuts

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