connctx

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package connctx wraps net.Conn using context.Context.

Deprecated: use netctx instead.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosing = errors.New("use of closed network connection")

ErrClosing is returned on Write to closed connection.

Functions

func Pipe

func Pipe() (ConnCtx, ConnCtx)

Pipe creates piped pair of ConnCtx.

Types

type ConnCtx

type ConnCtx interface {
	Reader
	Writer
	io.Closer
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Conn() net.Conn
}

ConnCtx is a wrapper of net.Conn using context.Context.

func New

func New(conn net.Conn) ConnCtx

New creates a new ConnCtx wrapping given net.Conn.

type ReadWriter

type ReadWriter interface {
	Reader
	Writer
}

ReadWriter is a composite of ReadWriter.

type Reader

type Reader interface {
	ReadContext(context.Context, []byte) (int, error)
}

Reader is an interface for context controlled reader.

type Writer

type Writer interface {
	WriteContext(context.Context, []byte) (int, error)
}

Writer is an interface for context controlled writer.

Jump to

Keyboard shortcuts

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