transport

package
v1.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("socket closed")
View Source
var ErrTimeout = errors.New("socket timeout")

Timeout error

Functions

This section is empty.

Types

type FrameHandshake added in v1.9.0

type FrameHandshake struct {
	Trans TransportMsg
	// contains filtered or unexported fields
}

FrameHandshake represents a stream with message semantics

func NewFrameHandshakeFromTransport added in v1.9.0

func NewFrameHandshakeFromTransport(t TransportMsg) *FrameHandshake

NewFrameHandshakeFromTransport creates a message stream from transport t

func (*FrameHandshake) Close added in v1.9.0

func (fh *FrameHandshake) Close() error

Close closes the transport stream

func (*FrameHandshake) ReadMsg added in v1.9.0

func (fh *FrameHandshake) ReadMsg(timeout time.Duration) ([]byte, error)

ReadMsg reads a io4edge standard message from transport without timeout

func (*FrameHandshake) WriteMsg added in v1.9.0

func (fh *FrameHandshake) WriteMsg(payload []byte) error

WriteMsg writes io4edge standard message to the transport stream

type FramedStream

type FramedStream struct {
	Trans Transport
	// contains filtered or unexported fields
}

FramedStream represents a stream with message semantics

func NewFramedStreamFromTransport

func NewFramedStreamFromTransport(t Transport) *FramedStream

NewFramedStreamFromTransport creates a message stream from transport t

func (*FramedStream) Close

func (fs *FramedStream) Close() error

Close closes the transport stream

func (*FramedStream) ReadMsg

func (fs *FramedStream) ReadMsg(timeout time.Duration) ([]byte, error)

ReadMsg reads a io4edge standard message from transport stream

func (*FramedStream) WriteMsg

func (fs *FramedStream) WriteMsg(payload []byte) error

WriteMsg writes io4edge standard message to the transport stream

type MsgStream

type MsgStream interface {
	ReadMsg(timeout time.Duration) ([]byte, error)
	WriteMsg(payload []byte) (err error)
	Close() error
}

MsgStream is the interface used by a Channel to exchange message frames with the transport layer e.g. socket, websocket...

type Transport

type Transport interface {
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	SetReadDeadline(t time.Time) error
	Close() error
}

Transport is the interface used by message stream to communicate with the underlying transport layer e.g. tcp sockets

type TransportMsg added in v1.9.0

type TransportMsg interface {
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	SetReadDeadline(t time.Time) error
	Close() error
}

TransportMsg is the interface used by message stream to communicate with the underlying transport layer e.g. udp sockets

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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