Documentation
¶
Overview ¶
Package frame defines frames for yomo.
Index ¶
- type AuthenticationAckFrame
- type AuthenticationFrame
- type BackflowFrame
- type Codec
- type DataFrame
- type Frame
- type GoawayFrame
- type HandshakeAckFrame
- type HandshakeFrame
- type HandshakeRejectedFrame
- type PacketReadWriter
- type ReadWriteCloser
- type ReadWriter
- type Reader
- type RejectedFrame
- type Tag
- type Type
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationAckFrame ¶ added in v1.13.0
type AuthenticationAckFrame struct{}
AuthenticationAckFrame is used to confirm that the client is authorized to access the requested DataStream from ControlStream, AuthenticationAckFrame is transmit on ControlStream. If the client-side receives this frame, it indicates that authentication was successful.
func (*AuthenticationAckFrame) Type ¶ added in v1.13.0
func (f *AuthenticationAckFrame) Type() Type
Type returns the type of AuthenticationAckFrame.
type AuthenticationFrame ¶ added in v1.11.0
AuthenticationFrame is used to authenticate the client, once the connection is established, the client immediately, sends information to the server, server gets the way to authenticate according to AuthName and use AuthPayload to do a authentication. AuthenticationFrame is transmit on ControlStream.
Reading the `auth.Authentication` interface will help you understand how AuthName and AuthPayload work.
func (*AuthenticationFrame) Type ¶ added in v1.11.0
func (f *AuthenticationFrame) Type() Type
Type returns the type of AuthenticationFrame.
type BackflowFrame ¶ added in v1.8.0
type BackflowFrame struct { // Tag is used for data router. Tag Tag // Carriage is the data to transmit. Carriage []byte }
The BackflowFrame is used to receive the processed result of a DataStream with StreamFunction type and forward it to a DataStream with StreamSource type.
func (*BackflowFrame) Type ¶ added in v1.8.0
func (f *BackflowFrame) Type() Type
Type returns the type of BackflowFrame.
type Codec ¶ added in v1.13.1
type Codec interface { // Decode decodes byte array to frame. Decode([]byte, Frame) error // Encode encodes frame to byte array. Encode(Frame) ([]byte, error) }
Codec encodes and decodes byte array to frame.
type DataFrame ¶
type DataFrame struct { // Metadata stores additional data beyond the Payload, // it is an map[string]string{} that be encoded in msgpack. Metadata []byte // Tag is used for data router. Tag Tag // Payload is the data to transmit. Payload []byte }
DataFrame carries tagged data to transmit across DataStream.
type Frame ¶
type Frame interface { // Type returns the type of frame. Type() Type }
Frame is the minimum unit required for Yomo to run. Yomo transmits various instructions and data through the frames.
following frame types are supported by Yomo:
- AuthenticationFrame
- AuthenticationAckFrame
- DataFrame
- HandshakeFrame
- HandshakeRejectedFrame
- HandshakeAckFrame
- RejectedFrame
- BackflowFrame
Read frame comments to understand the role of the frame.
type GoawayFrame ¶ added in v1.7.3
type GoawayFrame struct { // Message contains the reason why the connection be evicted. Message string }
GoawayFrame is is used by server to evict a connection.
func (*GoawayFrame) Type ¶ added in v1.7.3
func (f *GoawayFrame) Type() Type
Type returns the type of GoawayFrame.
type HandshakeAckFrame ¶ added in v1.10.0
type HandshakeAckFrame struct {
StreamID string
}
HandshakeAckFrame is used to ack handshake, If handshake successful, The server will send HandshakeAckFrame to the new DataStream, That means the initial frame received by the new DataStream must be the HandshakeAckFrame.
func (*HandshakeAckFrame) Type ¶ added in v1.10.0
func (f *HandshakeAckFrame) Type() Type
Type returns the type of HandshakeAckFrame.
type HandshakeFrame ¶
type HandshakeFrame struct { // Name is the name of the dataStream that will be created. Name string // ID is the ID of the dataStream that will be created. ID string // StreamType is the StreamType of the dataStream that will be created. StreamType byte // ObserveDataTags is the ObserveDataTags of the dataStream that will be created. ObserveDataTags []Tag // Metadata is the Metadata of the dataStream that will be created. Metadata []byte }
The HandshakeFrame is the frame through which the client obtains a new data stream from the server. It include essential details required for the creation of a fresh DataStream. The server then generates the DataStream utilizing this provided information.
func (*HandshakeFrame) Type ¶
func (f *HandshakeFrame) Type() Type
Type returns the type of HandshakeFrame.
type HandshakeRejectedFrame ¶ added in v1.12.0
type HandshakeRejectedFrame struct { // ID is the ID of DataStream be rejected. ID string // Message contains the reason why the handshake was not successful. Message string }
HandshakeRejectedFrame is employed to reject a handshake. It is transmitted over the ControlStream
func (*HandshakeRejectedFrame) Type ¶ added in v1.12.0
func (f *HandshakeRejectedFrame) Type() Type
Type returns the type of HandshakeRejectedFrame.
type PacketReadWriter ¶ added in v1.13.1
type PacketReadWriter interface { ReadPacket(io.Reader) (Type, []byte, error) WritePacket(io.Writer, Type, []byte) error }
PacketReadWriter reads packets from the io.Reader and writes packets to the io.Writer. If read failed, return the frameType, the data of the packet and an error.
type ReadWriteCloser ¶ added in v1.13.1
ReadWriteCloser is the interface that groups the ReadFrame, WriteFrame and Close methods.
type ReadWriter ¶ added in v1.10.0
ReadWriter is the interface that groups the ReadFrame and WriteFrame methods.
type Reader ¶ added in v1.10.0
type Reader interface { // ReadFrame reads a frame, if an error occurs, the returned error will not be empty, // and the returned frame will be nil. ReadFrame() (Frame, error) }
Reader reads frame from underlying stream.
type RejectedFrame ¶
type RejectedFrame struct { // Message encapsulates the rationale behind the rejection of the request. Message string }
RejectedFrame is used to reject a ControlStream request.
func (*RejectedFrame) Type ¶
func (f *RejectedFrame) Type() Type
Type returns the type of RejectedFrame.
type Type ¶
type Type byte
Type defined The type of frame.
const ( TypeAuthenticationFrame Type = 0x03 // TypeAuthenticationFrame is the type of AuthenticationFrame. TypeAuthenticationAckFrame Type = 0x11 // TypeAuthenticationAckFrame is the type of AuthenticationAckFrame. TypeDataFrame Type = 0x3F // TypeDataFrame is the type of DataFrame. TypeHandshakeFrame Type = 0x31 // TypeHandshakeFrame is the type of PayloadFrame. TypeHandshakeRejectedFrame Type = 0x14 // TypeHandshakeRejectedFrame is the type of HandshakeRejectedFrame. TypeHandshakeAckFrame Type = 0x29 // TypeHandshakeAckFrame is the type of HandshakeAckFrame. TypeRejectedFrame Type = 0x39 // TypeRejectedFrame is the type of RejectedFrame. TypeBackflowFrame Type = 0x2D // TypeBackflowFrame is the type of BackflowFrame. TypeGoawayFrame Type = 0x2E // TypeGoawayFrame is the type of GoawayFrame. )