conn

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buff

type Buff struct {
	*bufconn.Listener
	// contains filtered or unexported fields
}

Buff implements ListenerDialer localed. It can use to start a mock server, client connect to server with its transport or dial func.

func (*Buff) DialContext

func (l *Buff) DialContext(ctx context.Context, _, _ string) (net.Conn, error)

DialContext return new net.Conn connection to the Buff Listener

type ListenerDialer

type ListenerDialer interface {
	net.Listener
	DialContext(ctx context.Context, _, _ string) (net.Conn, error)
}

ListenerDialer embeds net.Listener and DialContext, DialContext create a new connection to the listener

func MustNewTCP

func MustNewTCP(addr string) ListenerDialer

MustNewTCP returns a ListenerDialer or panic on error

func NewBuff

func NewBuff() ListenerDialer

func NewTCP

func NewTCP(addr string) (ListenerDialer, error)

NewTCP returns a ListenerDialer that listens and dial on TCP

type TCP

type TCP struct {
	net.Listener
	// contains filtered or unexported fields
}

TCP listens and dials on a TCP address

func (*TCP) DialContext

func (l *TCP) DialContext(ctx context.Context, _, _ string) (net.Conn, error)

Jump to

Keyboard shortcuts

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