Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

bufconn

v1.14.0
github.com/bglmmz/grpc/test/bufconn

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

7 matches

Top ↑

Package bufconn provides a net.Conn implemented by a buffer and related dialing and listening functionality.

Types

Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener implements a net.Listener that creates local, buffered net.Conns via its Accept and Dial method.

Listen

func Listen(sz int) *Listener

Listen returns a Listener that can only be contacted by its own Dialers and creates buffered connections between the two.

Listener.Accept

func (l *Listener) Accept() (net.Conn, error)

Accept blocks until Dial is called, then returns a net.Conn for the server half of the connection.

Listener.Addr

func (l *Listener) Addr() net.Addr

Addr reports the address of the listener.

Listener.Close

func (l *Listener) Close() error

Close stops the listener.

Listener.Dial

func (l *Listener) Dial() (net.Conn, error)

Dial creates an in-memory full-duplex network connection, unblocks Accept by providing it the server half of the connection, and returns the client half of the connection.

Dependency graph