server

package
v0.0.0-...-6f51d7c Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 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

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

func HandleFunc

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

func (FuncHandler) Handle

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

type Handler

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