server

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncHandler added in v0.3.0

type FuncHandler func(context.Context, *net.UDPConn, *net.UDPAddr, []byte)

func HandleFunc added in v0.3.0

func HandleFunc(f func(context.Context, *net.UDPConn, *net.UDPAddr, []byte)) FuncHandler

func (FuncHandler) Handle added in v0.3.0

func (f FuncHandler) Handle(
	ctx context.Context,
	conn *net.UDPConn,
	addr *net.UDPAddr,
	payload []byte,
)

type Handler added in v0.3.0

type Handler interface {
	Handle(context.Context, *net.UDPConn, *net.UDPAddr, []byte)
}

type Option

type Option func(*Server) error

func WithBufferSize

func WithBufferSize(sz int) Option

func WithReadySignal

func WithReadySignal(cb func()) Option

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(addr string, handler Handler, opts ...Option) (*Server, error)

func (*Server) Listen

func (s *Server) Listen() error

func (*Server) LocalAddr

func (s *Server) LocalAddr() *net.UDPAddr

func (*Server) LocalAddrPort

func (s *Server) LocalAddrPort() netip.AddrPort

func (*Server) Stop

func (s *Server) Stop() error

Jump to

Keyboard shortcuts

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