fakeconn

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fakeconn provides a "fake" net.Conn implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Written  *bytes.Buffer
	ReadFrom *bytes.Buffer
	// contains filtered or unexported fields
}

Conn is a fake net.Conn implementations. Everything that is written to it with Write() is available in the Written buffer, and Read() reads from the data in the ReadFrom buffer.

func New

func New() Conn

New instance factory.

func (Conn) Close

func (c Conn) Close() error

Close clears the buffers and prevents further Read() and Write() operations.

func (Conn) LocalAddr

func (c Conn) LocalAddr() net.Addr

LocalAddr does nothing.

func (Conn) Read

func (c Conn) Read(b []byte) (n int, err error)

Read data from the ReadFrom buffer.

func (Conn) RemoteAddr

func (c Conn) RemoteAddr() net.Addr

RemoteAddr does nothing.

func (Conn) SetDeadline

func (c Conn) SetDeadline(t time.Time) error

SetDeadline does nothing.

func (Conn) SetReadDeadline

func (c Conn) SetReadDeadline(t time.Time) error

SetReadDeadline does nothing.

func (Conn) SetWriteDeadline

func (c Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline does nothing.

func (Conn) Write

func (c Conn) Write(b []byte) (n int, err error)

Write data to the Written buffer.

Jump to

Keyboard shortcuts

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