netevents

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialContextFunc

func DialContextFunc(dial func(context.Context, string, string) (net.Conn, error)) func(context.Context, string, string) (net.Conn, error)

DialContextFunc returns a wrapper for dial which logs with the default logger all opening and closing events that occur on the connections returned by the dial function.

func DialContextFuncWith

func DialContextFuncWith(logger *events.Logger, dial func(context.Context, string, string) (net.Conn, error)) func(context.Context, string, string) (net.Conn, error)

DialContextFuncWith returns a wrapper for dial which logs with logger all opening and closing events that occur on the connections returned by the dial function.

func DialFunc

func DialFunc(dial func(string, string) (net.Conn, error)) func(string, string) (net.Conn, error)

DialFunc returns a wrapper for dial which logs with the default logger all opening and closing events that occur on the connections returned by the dial function.

func DialFuncWith

func DialFuncWith(logger *events.Logger, dial func(string, string) (net.Conn, error)) func(string, string) (net.Conn, error)

DialFuncWith returns a wrapper for dial which logs with logger all opening and closing events that occur on the connections returned by the dial function.

func NewListener

func NewListener(listener net.Listener) net.Listener

NewListener returns a wrapped version of listener which logs with the default logger all accept and close events that occur on the listener.

func NewListenerWith

func NewListenerWith(logger *events.Logger, listener net.Listener) net.Listener

NewListenerWith returns a wrapped version of listener which logs with logger all accept and close events that occur on the listener.

Types

type Handler

type Handler interface {
	ServeConn(ctx context.Context, conn net.Conn)
}

Handler is an interface that can be implemented by types that serve network connections.

func NewHandler

func NewHandler(handler Handler) Handler

NewHandler returns a wrapped handler which logs with the default logger all opening and closing events that occur on the connections servied by the handler.

func NewHandlerWith

func NewHandlerWith(logger *events.Logger, handler Handler) Handler

NewHandlerWith returns a wrapped handler which logs with logger all opening and closing events that occur on the connections served by the handler with logger.

Jump to

Keyboard shortcuts

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