udp

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2017 License: MIT Imports: 8 Imported by: 0

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 Service

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

	Logger *log.Logger
	// 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, l *log.Logger) *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