telemetry

package
v0.0.0-...-316aa0a Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SyslogSNI is the server name for TLS when connecting to the Controller
	// for Syslog ingress
	SyslogSNI = "syslog.controller.openness"

	// StatsdSNI is the server name for TLS when connecting to the Controller
	// for StatsD ingress
	StatsdSNI = "statsd.controller.openness"
)
View Source
const MaxUDPPacketSize = 64*1024 - 8 - 20

MaxUDPPacketSize is the maximum size of the packet (64kb) minus the UDP header (8 bytes) and the IP header (20 bytes minimum for IPv4).

Variables

This section is empty.

Functions

func AcceptTCP

func AcceptTCP(lis net.Listener) func() (io.ReadCloser, error)

AcceptTCP wraps the Accept method on a TCP listener.

func AcceptUDP

func AcceptUDP(ctx context.Context, addr string) func() (io.ReadCloser, error)

AcceptUDP accepts new UDP connections and returns a reader that reads up to one full packet at a time with a newline always appended. The appended newline ensures that packets are delimited as long as one full packet is read at a time. Therefore it is important that each read is done into a buffer with enough space for a UDP packet and a newline character.

func WriteToByLine

func WriteToByLine(w io.Writer, bufSize int, accept func() (io.ReadCloser, error)) error

WriteToByLine accepts inbound connections and concurrently writes the lines directly to disk. By using the AcceptTCP and AcceptUDP helper functions, newlines are handled properly.

Setting a buffer size is optional for TCP or any stream-based protocol, but recommended for packet protocols such as UDP unless the caller can be sure that all packet contents will end with a newline.

When expecting packets without a guaranteed newline ending, the read buffer size must be large enough for the complete contents of a UDP packet and a newline. For UDP over IP, it is safe to use a bufSize of MaxUDPPacketSize+1.

Types

This section is empty.

Jump to

Keyboard shortcuts

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