buffered

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn wraps a net.Conn and provides buffered ability.

func NewConn

func NewConn(c net.Conn, options ...Option) *Conn

NewConn creates a new sniffed connection.

func (*Conn) Buffered

func (m *Conn) Buffered() (n int)

Buffered returns the pending buffer size.

func (*Conn) Close

func (m *Conn) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (*Conn) Flush

func (m *Conn) Flush() (n int, err error)

Flush flushes the underlying buffer by writing into the underlying connection.

func (*Conn) LocalAddr

func (m *Conn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Conn) Read

func (m *Conn) Read(p []byte) (int, error)

Read reads the block of data from the underlying buffer.

func (*Conn) Reader

func (m *Conn) Reader() *bufio.Reader

Reader 返回内部的 bufio.Reader

func (*Conn) RemoteAddr

func (m *Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Conn) SetDeadline

func (m *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

func (*Conn) SetReadDeadline

func (m *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call.

func (*Conn) SetWriteDeadline

func (m *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call.

func (*Conn) Write

func (m *Conn) Write(p []byte) (nn int, err error)

Write writes the block of data into the underlying buffer.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option 配置 Conn 的选项接口

func BufferSize

func BufferSize(bufferSize int) Option

BufferSize Conn 缓冲大小

func FlushRate

func FlushRate(r int) Option

FlushRate Conn 写操作的每秒刷新频率

Jump to

Keyboard shortcuts

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