package fakeconn
import "zgo.at/zstd/ztest/fakeconn"
Package fakeconn provides a "fake" net.Conn implementation.
Index ¶
- type Conn
- func New() Conn
- func (c Conn) Close() error
- func (c Conn) LocalAddr() net.Addr
- func (c Conn) Read(b []byte) (n int, err error)
- func (c Conn) RemoteAddr() net.Addr
- func (c Conn) SetDeadline(t time.Time) error
- func (c Conn) SetReadDeadline(t time.Time) error
- func (c Conn) SetWriteDeadline(t time.Time) error
- func (c Conn) Write(b []byte) (n int, err error)
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 ¶
Close clears the buffers and prevents further Read() and Write() operations.
func (Conn) LocalAddr ¶
LocalAddr does nothing.
func (Conn) Read ¶
Read data from the ReadFrom buffer.
func (Conn) RemoteAddr ¶
RemoteAddr does nothing.
func (Conn) SetDeadline ¶
SetDeadline does nothing.
func (Conn) SetReadDeadline ¶
SetReadDeadline does nothing.
func (Conn) SetWriteDeadline ¶
SetWriteDeadline does nothing.
func (Conn) Write ¶
Write data to the Written buffer.
Source Files ¶
fakeconn.go
- Version
- v0.0.0-20241125224656-49fafbb06ca9 (latest)
- Published
- Nov 25, 2024
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 3 days ago –
Tools for package owners.