pipe

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLinks(limit int32, discard bool) (*Link, *Link)

Types

type Link struct {
	Reader *Pipe
	Writer *Pipe
}

func (*Link) Close

func (l *Link) Close() error

func (*Link) CloseRead

func (l *Link) CloseRead() error

func (*Link) CloseWrite

func (l *Link) CloseWrite() error

func (*Link) Interrupt

func (l *Link) Interrupt(err error)

func (*Link) ReadMultiBuffer

func (l *Link) ReadMultiBuffer() (buf.MultiBuffer, error)

func (*Link) ReadMultiBufferTimeout

func (l *Link) ReadMultiBufferTimeout(d time.Duration) (buf.MultiBuffer, error)

func (*Link) SetDeadline

func (p *Link) SetDeadline(t time.Time) error

func (*Link) SetReadDeadline

func (p *Link) SetReadDeadline(t time.Time) error

func (*Link) SetWriteDeadline

func (p *Link) SetWriteDeadline(t time.Time) error

func (*Link) WriteMultiBuffer

func (l *Link) WriteMultiBuffer(mb buf.MultiBuffer) error

type LinkConn

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

func NewLinkConn

func NewLinkConn(link *Link, localAddr net.Addr,
	remoteAddr net.Addr, udp bool) *LinkConn

func (*LinkConn) Close

func (l *LinkConn) Close() error

func (*LinkConn) CloseWrite

func (l *LinkConn) CloseWrite() error

func (*LinkConn) LocalAddr

func (l *LinkConn) LocalAddr() net.Addr

func (*LinkConn) Read

func (l *LinkConn) Read(b []byte) (n int, err error)

func (*LinkConn) ReadFrom

func (l *LinkConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*LinkConn) ReadMultiBuffer

func (l *LinkConn) ReadMultiBuffer() (buf.MultiBuffer, error)

func (*LinkConn) RemoteAddr

func (l *LinkConn) RemoteAddr() net.Addr

func (*LinkConn) SetDeadline

func (l *LinkConn) SetDeadline(t time.Time) error

func (*LinkConn) SetReadDeadline

func (l *LinkConn) SetReadDeadline(t time.Time) error

func (*LinkConn) SetWriteDeadline

func (l *LinkConn) SetWriteDeadline(t time.Time) error

func (*LinkConn) Write

func (l *LinkConn) Write(b []byte) (n int, err error)

func (*LinkConn) WriteMultiBuffer

func (l *LinkConn) WriteMultiBuffer(mb buf.MultiBuffer) error

func (*LinkConn) WriteTo

func (l *LinkConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type Pipe

type Pipe struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPipe

func NewPipe(limit int32, discardOverflow bool) *Pipe

discardOverflow is true when creating a pipe for udp traffic.

func (*Pipe) Close

func (p *Pipe) Close() error

CloseWrite

func (*Pipe) CloseWrite

func (p *Pipe) CloseWrite() error

func (*Pipe) Interrupt

func (p *Pipe) Interrupt(err error)

Interrupt implements common.Interruptible. release buffers, mark it a done can be used to tell the other end of the pipe that something went wrong.

func (*Pipe) ReadMultiBuffer

func (p *Pipe) ReadMultiBuffer() (buf.MultiBuffer, error)

func (*Pipe) ReadMultiBufferTimeout

func (p *Pipe) ReadMultiBufferTimeout(d time.Duration) (buf.MultiBuffer, error)

func (*Pipe) SetDeadline

func (p *Pipe) SetDeadline(t time.Time) error

SetDeadline sets both read and write deadlines.

func (*Pipe) SetReadDeadline

func (p *Pipe) SetReadDeadline(t time.Time) error

SetReadDeadline sets the read deadline.

func (*Pipe) SetWriteDeadline

func (p *Pipe) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the write deadline.

func (*Pipe) WriteMultiBuffer

func (p *Pipe) WriteMultiBuffer(mb buf.MultiBuffer) error
  1. when its full a. discardOverflow -> discard the mb b. not discardOverflow -> wait
  2. when not full or empty, and return nil immedietlly

func (*Pipe) WriteMultiBufferTimeout

func (p *Pipe) WriteMultiBufferTimeout(mb buf.MultiBuffer, d time.Duration) error

Jump to

Keyboard shortcuts

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