Documentation
¶
Index ¶
Constants ¶
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" )
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 ¶
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 ¶
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.