netutil

package
v1.28.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 6 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TCPListener

type TCPListener struct {
	// ReadTimeout is timeout for each Read call on accepted conns.
	//
	// By default it isn't set.
	//
	// Set ReadTimeout before calling Accept the first time.
	ReadTimeout time.Duration

	// WriteTimeout is timeout for each Write call on accepted conns.
	//
	// By default it isn't set.
	//
	// Set WriteTimeout before calling Accept the first time.
	WriteTimeout time.Duration

	net.Listener
	// contains filtered or unexported fields
}

TCPListener listens for the addr passed to NewTCPListener.

It also gathers various stats for the accepted connections.

func NewTCPListener

func NewTCPListener(name, addr string) (*TCPListener, error)

NewTCPListener returns new TCP listener for the given addr.

name is used for exported metrics. Each listener in the program must have distinct name.

func (*TCPListener) Accept

func (ln *TCPListener) Accept() (net.Conn, error)

Accept accepts connections from the addr passed to NewTCPListener.

Jump to

Keyboard shortcuts

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