bufconn

package module
v0.0.0-...-fd7c026 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	net.Conn

	// Head exposes a bufio.Reader on top of this Conn meant to read the beginning
	// portion (head) of the data.
	Head() *bufio.Reader
}

Conn is a net.Conn that also exposes a bufio.Reader on top of that conn. The bufio.Reader is intended to be used first, after which it is safe to read from the Conn. Even if the buffered reader buffered more than necessary to serve its consumer, no data will be lost when starting to read from the Conn. Once reading from the Conn has begun, Head() should not be called and may return a nil bufio.Reader or one in an inconsistent state.

func Wrap

func Wrap(wrapped net.Conn) Conn

Wrap wraps a net.Conn with support for save buffered reading of the head.

Jump to

Keyboard shortcuts

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