connctx

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 7 Imported by: 6

Documentation

Overview

Package connctx wraps net.Conn using context.Context.

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 added in v0.11.1

type ReadWriter interface {
	Reader
	Writer
}

ReadWriter is a composite of ReadWriter.

type Reader added in v0.11.1

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

Reader is an interface for context controlled reader.

type Writer added in v0.11.1

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