wire

package module
v0.0.0-...-b5124f3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2016 License: MIT Imports: 4 Imported by: 8

README

GoDoc license

This library provides parsing logic on ResourceD TCP wire protocol.

Example:

type:base64|created:unix-timestamp|content:base64=
type:plain|created:unix-timestamp|content:plaintext
type:json|created:unix-timestamp|content:{"foo": "bar"}
topic:topic-name|type:json|created:unix-timestamp|content:{"foo": "bar"}  # inside master's MessageBus.

In one TCP connection, you can send multiple payloads by separating them using \n.

Where does it get used?

  • Agent: User can send a log line to the agent using this protocol.

  • Master: Within Master daemon, it is used for passing data through the message bus.

Documentation

Overview

Package wire provides parsing logic on ResourceD TCP wire protocol. The protocol looks like this:

type:base64|created:unix-timestamp|content:base64=
type:plain|created:unix-timestamp|content:plaintext
type:json|created:unix-timestamp|content:{"foo": "bar"}

Within Master daemon, this wire format is used for passing data through the message bus. The protocol looks like this:

topic:topic-name|type:json|created:unix-timestamp|content:{"foo": "bar"}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wire

type Wire struct {
	Topic   string
	Type    string
	Created int64
	Content string
}

func Parse

func Parse(stringLoglines string) []Wire

Parse multiple lines of ResourceD TCP wire protocol.

func ParseSingle

func ParseSingle(logline string) Wire

ParseSingle parses a single line of ResourceD TCP wire protocol.

func (Wire) Base64Content

func (l Wire) Base64Content() string

Base64Content returns the base64 version of content.

func (Wire) EncodeBase64

func (l Wire) EncodeBase64() string

EncodePlain builds the wire protocol for base64 type.

func (Wire) EncodeJSON

func (l Wire) EncodeJSON() string

func (Wire) EncodePlain

func (l Wire) EncodePlain() string

EncodePlain builds the wire protocol for plaintext type.

func (Wire) JSONStringContent

func (l Wire) JSONStringContent() string

JSONStringContent returns the JSON content.

func (Wire) PlainContent

func (l Wire) PlainContent() string

PlainContent returns the plaintext version of content.

Jump to

Keyboard shortcuts

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