msg

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxMsgLength int64 = 1024

MaxMsgLength defines the maximum length of a message.

Functions

func Pack

func Pack(msg Message) (b []byte, err error)

Pack a message becomes []byte.

func ReadInto

func ReadInto(r io.Reader, msg Message) (err error)

ReadInto read a message into `msg` from reader.

func UnPackInto

func UnPackInto(b []byte, msg Message) (err error)

UnPackInto will unpack the []byte to `msg`.

func Write

func Write(w io.Writer, msg interface{}) (err error)

Write a message to the writer.

Types

type Error

type Error struct {
	Message string
}

Error describes an error message that is primarily used by the server to return to the client.

type Message

type Message interface{}

The Message is defined as interface{}, which is the base class for all messages.

func Read

func Read(r io.Reader) (msg Message, err error)

Read a message from reader.

func UnPack

func UnPack(t byte, b []byte) (Message, error)

UnPack to a message according to type `t`.

type Proxy

type Proxy struct {
	ID       string
	Token    string
	Version  string
	Hostname string
	Os       string
	Arch     string
}

Proxy describes a proxy message for a client to connect to the server.

type Version

type Version struct {
	Version string
}

Version contains the server release information back to the client when the client tries to establish a proxy with the server.

type Worker

type Worker struct {
	ID string
}

Worker indicates that the server initiates a reverse connection to the client.

Jump to

Keyboard shortcuts

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