net

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn

	Stats *Stats
	// contains filtered or unexported fields
}

Conn is a net connection wrapper.

func Dial

func Dial(network, address string, timeout time.Duration) (*Conn, error)

func New

func New(rawConn net.Conn) *Conn

New returns a Conn wrapper.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) CloseRead

func (c *Conn) CloseRead() error

CloseRead shuts down the reading side of the connection if support.

func (*Conn) CloseWrite

func (c *Conn) CloseWrite() error

CloseWrite shuts down the writing side of the connection if support.

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

Read reads data from the connection.

func (*Conn) SetInBytesCounter

func (c *Conn) SetInBytesCounter(u *atomic.Uint64)

SetInBytesCounter set the input bytes counter.

func (*Conn) SetOutBytesCounter

func (c *Conn) SetOutBytesCounter(u *atomic.Uint64)

SetOutBytesCounter set the output bytes counter.

func (*Conn) SetReadTimeout

func (c *Conn) SetReadTimeout(timeout time.Duration)

SetReadTimeout sets the read timeout.

func (*Conn) SetStats

func (c *Conn) SetStats(stats *Stats)

SetStats sets the stats.

func (*Conn) SetWriteTimeout

func (c *Conn) SetWriteTimeout(timeout time.Duration)

SetWriteTimeout sets the write timeout.

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Write writes data to the connection.

type Stats

type Stats struct {
	ReadTotal  *stats.Counter
	WriteTotal *stats.Counter
	Duration   *stats.Histogram
}

Stats represents the Conn stats.

Jump to

Keyboard shortcuts

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