udp

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxInFlight = 1024

MaxInFlight bounds the number of datagrams handled concurrently per entrypoint so a flood of packets cannot spawn unbounded goroutines.

View Source
var MaxPacketSize = 65535

MaxPacketSize is the read buffer size for a single datagram.

65535 is the maximum theoretical UDP payload size.

Functions

This section is empty.

Types

type Handler

type Handler = func(conn net.PacketConn, addr net.Addr, data []byte) error

Handler processes a single datagram. It may write a response back to the peer through conn.WriteTo(resp, addr). Returning an error stops the chain and drops the packet.

type Middleware

type Middleware struct {
	Name string
	Conn Handler
}

type Router

type Router struct {
	EntryPoints []string `cfg:"entrypoints"`
	Middlewares []string `cfg:"middlewares"`
}

type UDP

type UDP struct {
	Routers     map[string]Router        `cfg:"routers"`
	Middlewares map[string]UDPMiddleware `cfg:"middlewares"`
}

func (*UDP) Set

func (h *UDP) Set(ctx context.Context, wg *sync.WaitGroup) error

type UDPMiddleware

type UDPMiddleware struct {
	DNSMiddleware         *dns.DNS                 `cfg:"dns"`
	RedirectMiddleware    *redirect.Redirect       `cfg:"redirect"`
	IPAllowListMiddleware *ipallowlist.IPAllowList `cfg:"ip_allow_list"`
}

func (*UDPMiddleware) Set

func (h *UDPMiddleware) Set(ctx context.Context, name string) error

Directories

Path Synopsis
middleware
dns
Package dns is a UDP middleware that answers DNS queries from a set of statically configured records, falling back to upstream resolvers for names it does not own.
Package dns is a UDP middleware that answers DNS queries from a set of statically configured records, falling back to upstream resolvers for names it does not own.

Jump to

Keyboard shortcuts

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