udp

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 9 Imported by: 71

Documentation

Index

Constants

View Source
const (
	// The number of packets to buffer when reading off the socket.
	// A buffer of this size will be allocated for each instance of a UDP service.
	DefaultBuffer int = 1e3
)
View Source
const (
	UDPPacketSize = 65536
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled     bool   `toml:"enabled"`
	BindAddress string `toml:"bind-address"`
	ReadBuffer  int    `toml:"read-buffer"`
	Buffer      int    `toml:"buffer"`

	Database        string `toml:"database"`
	RetentionPolicy string `toml:"retention-policy"`
}

func (*Config) WithDefaults

func (c *Config) WithDefaults() *Config

WithDefaults takes the given config and returns a new config with any required default values set.

type Diagnostic added in v1.4.0

type Diagnostic interface {
	Error(msg string, err error, ctx ...keyvalue.T)
	StartedListening(addr string)
	ClosedService()
}

type Service

type Service struct {
	PointsWriter interface {
		WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, points []models.Point) error
	}

	Diag Diagnostic
	// contains filtered or unexported fields
}

Service represents here an UDP service that will listen for incoming packets formatted with the inline protocol

func NewService

func NewService(c Config, diag Diagnostic) *Service

func (*Service) Addr

func (s *Service) Addr() *net.UDPAddr

func (*Service) Close

func (s *Service) Close() error

func (*Service) Open

func (s *Service) Open() (err error)

Jump to

Keyboard shortcuts

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