quickproto

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-2.0 Imports: 3 Imported by: 0

README

Fast golang protocol parser

Supports:

  • Headers (Support listed values, IE: Key=[Value, Value, Value])
  • Body (Can be encoded/decoded to base64)
  • Delimiters

Data is split apart by the delimiter.

Say the delimiter is a $:

The body and header will be split by the delimiter * 4

Each key value pair will be split by the delimiter * 2

Then the key values will be split by the delimiter.

Example:

key1$value1&value2$$key2$value2$$$$BODYBODYBODY

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Data       []byte
	Delimiter  []byte
	Headers    map[string][]string
	Body       []byte
	Use_Base64 bool
}

A Message is a protocol message.

func NewMessage

func NewMessage(delimiter []byte, use_b64 bool) *Message

NewMessage creates a new Message.

func (*Message) AddHeader added in v1.1.1

func (m *Message) AddHeader(key string, value string)

func (*Message) ContentLength

func (m *Message) ContentLength() int

Get content length of the message.

func (*Message) Generate

func (m *Message) Generate() (*Message, error)

creates a protocol message. Header is a map of key/value pairs. Body is a base64 encoded byte slice.

func (*Message) Parse

func (m *Message) Parse() (*Message, error)

parses protocol messages. Header is a map of key/value pairs. Body is a base64 encoded byte slice.

Jump to

Keyboard shortcuts

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