udp

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUDPChannelSize is the default size of the data channel
	DefaultUDPChannelSize = 100

	// DefaultUDPWorkers is the default number of worker goroutines
	DefaultUDPWorkers = 1

	// DefaultUDPWriteTimeout is the default timeout for writing data to UDP connections
	DefaultUDPWriteTimeout = 5 * time.Second

	// DefaultUDPStopTimeout is the default timeout for graceful shutdown
	DefaultUDPStopTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UDP

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

UDP implements the Output interface for UDP connections

func New

func New(logger *zap.Logger, host, port string, workers int) (*UDP, error)

New creates a new UDP output instance

func (*UDP) Stop

func (u *UDP) Stop(ctx context.Context) error

Stop gracefully shuts down all workers and closes UDP connections Stop shall not be called more than once. If the provided context is done, Stop will return immediately even if workers are still shutting down.

func (*UDP) Write

func (u *UDP) Write(ctx context.Context, data output.LogRecord) error

Write sends data to the UDP output channel for processing by workers. Write shall not be called after Stop is called. If the provided context is done, Write will return immediately even if the data is not written to the channel.

Jump to

Keyboard shortcuts

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