v1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package v1 implements the lumberjack server supporting protocol version 1.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProtocolError is returned if an protocol error was detected in the
	// conversation with lumberjack server.
	ErrProtocolError = errors.New("lumberjack protocol error")
)

Functions

This section is empty.

Types

type Option

type Option func(*options) error

Option type for configuring server run options.

func Channel

func Channel(c chan *lj.Batch) Option

Channel option is used to register custom channel received batches will be forwarded to.

func TLS

func TLS(tls *tls.Config) Option

TLS enables and configures TLS support in lumberjack server. Protocol version 1 mandates TLS being enabled.

func Timeout

func Timeout(to time.Duration) Option

Timeout configures server network timeouts.

type Server

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

Server serves multiple lumberjack clients supporting protocol version 1.

func ListenAndServe

func ListenAndServe(addr string, opts ...Option) (*Server, error)

ListenAndServe listens on the TCP network address addr and handles batch requests from accepted lumberjack clients.

func ListenAndServeWith

func ListenAndServeWith(
	binder func(network, addr string) (net.Listener, error),
	addr string,
	opts ...Option,
) (*Server, error)

ListenAndServeWith uses binder to create a listener for establishing a lumberjack endpoint.

func NewWithListener

func NewWithListener(l net.Listener, opts ...Option) (*Server, error)

NewWithListener creates a new Server using an existing net.Listener.

func (*Server) Close

func (s *Server) Close() error

Close stops the listener, closes all active connections and closes the receiver channel returned from ReceiveChan().

func (*Server) Receive

func (s *Server) Receive() *lj.Batch

Receive returns the next received batch from the receiver channel. Batches returned by Receive must be ACKed.

func (*Server) ReceiveChan

func (s *Server) ReceiveChan() <-chan *lj.Batch

ReceiveChan returns a channel all received batch requests will be made available on. Batches read from channel must be ACKed.

Jump to

Keyboard shortcuts

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