netutil

package
v0.0.0-...-ac0c594 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFullBuffer = errors.New("full buffer")
	ErrClosed     = errors.New("closed")
)

Functions

func DoR

func DoR(c net.Conn, do func(int)) net.Conn

func Unread

func Unread(c net.Conn, data []byte) net.Conn

Types

type ConnChecker

type ConnChecker struct {
	net.Conn
	context.Context
	// contains filtered or unexported fields
}

func NewConnChecker

func NewConnChecker(c net.Conn) (cc *ConnChecker)

NewConnChecker creates a ConnChecker cc that periodically checks if c is no longer readable (closed or lost); if yes, it cancels cc.Context.

c must not be used afterward (use cc instead).

func (*ConnChecker) Close

func (c *ConnChecker) Close() error

func (*ConnChecker) Read

func (c *ConnChecker) Read(p []byte) (n int, err error)

func (*ConnChecker) SetDeadline

func (c *ConnChecker) SetDeadline(t time.Time) error

func (*ConnChecker) SetReadDeadline

func (c *ConnChecker) SetReadDeadline(t time.Time) error

func (*ConnChecker) Stop

func (c *ConnChecker) Stop()

type ConnReplayer

type ConnReplayer struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConnReplayer

func NewConnReplayer(c net.Conn) *ConnReplayer

func (*ConnReplayer) Read

func (c *ConnReplayer) Read(b []byte) (n int, err error)

func (*ConnReplayer) Replay

func (c *ConnReplayer) Replay() bool

func (*ConnReplayer) Stop

func (c *ConnReplayer) Stop()

func (*ConnReplayer) Stopped

func (c *ConnReplayer) Stopped() bool

Jump to

Keyboard shortcuts

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