Documentation ¶
Overview ¶
Package codec is an interface for encoding messages
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidMessage = errors.New("invalid message")
)
Functions ¶
This section is empty.
Types ¶
type LogBody ¶
type LogBody struct { Name string `json:"name"` Log string `json:"log"` Tags []map[string]interface{} `json:"tags"` Timestamp time.Time `json:"timestamp"` }
LogBody describe body of a single packets. It contains the name of log with log to store and tags along with timestamp field which contains the time of creation of log
type NewCodec ¶
type NewCodec func(io.ReadWriteCloser) Codec
Takes in a connection/buffer and returns a new Codec
type Packet ¶
type Packet struct { // ID of packet ID uuid.UUID `json:"id"` // Cmd is command containing the packets Cmd string `json:"cmd"` // Body is body of associated with command Body *LogBody `json:"body"` // Ack acknowledges for sent request Ack bool // Error Error error // Timestamp is time of packet creation. Timestamp time.Time `json:"timestamp"` }
Packet is type of every packet that gets transported from client to server to client.
Click to show internal directories.
Click to hide internal directories.