netutil

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FatalIfUnexpected

func FatalIfUnexpected(err error)

FatalIfUnexpected calls Log.Fatal(err) unless err is nil, cmux.ErrListenerClosed, or the net package's errClosed.

func IsClosedConnection

func IsClosedConnection(err error) bool

IsClosedConnection returns true if err is cmux.ErrListenerClosed, grpc.ErrServerStopped, io.EOF, or the net package's errClosed.

func ListenAndServeGRPC

func ListenAndServeGRPC(
	stopper *stop.Stopper, server *grpc.Server, addr net.Addr,
) (net.Listener, error)

ListenAndServeGRPC creates a listener and serves the specified grpc Server on it, closing the listener when signalled by the stopper.

Types

type Server

type Server struct {
	*http.Server
}

Server is a thin wrapper around http.Server. See MakeServer for more detail.

func MakeServer

func MakeServer(stopper *stop.Stopper, tlsConfig *tls.Config, handler http.Handler) Server

MakeServer constructs a Server that tracks active connections, closing them when signalled by stopper.

func (*Server) ServeWith

func (s *Server) ServeWith(
	ctx context.Context, stopper *stop.Stopper, l net.Listener, serveConn func(net.Conn),
) error

ServeWith accepts connections on ln and serves them using serveConn.

Jump to

Keyboard shortcuts

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