bufconn

package
v1.44.0-dev Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 6 Imported by: 347

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.

func 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.

func (*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.

func (*Listener) Addr

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

Addr reports the address of the listener.

func (*Listener) Close

func (l *Listener) Close() error

Close stops the listener.

func (*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.

func (*Listener) DialContext added in v1.41.0

func (l *Listener) DialContext(ctx context.Context) (net.Conn, error)

DialContext 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. If ctx is Done, returns ctx.Err()

Jump to

Keyboard shortcuts

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