common

package
v0.24.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MessageFormat    = "%s||%s||%s" // message key || message type || message body
	MessageSeparator = "||"
)

Variables

This section is empty.

Functions

func FormatMessage

func FormatMessage(msgKey string, messageType MessageType, body string) string

Types

type HTTPMessage added in v0.16.6

type HTTPMessage struct {
	Hijack  bool                `json:"hijack,omitempty"`
	Host    string              `json:"host,omitempty"`
	Method  string              `json:"method,omitempty"`
	URL     string              `json:"url,omitempty"`
	Headers map[string][]string `json:"headers,omitempty"`
	Code    int                 `json:"code,omitempty"`
	Body    []byte              `json:"body,omitempty"`
	EOF     bool                `json:"eof,omitempty"`
}

type Message

type Message struct {
	Key  string
	Type MessageType
	Body string
}

func ParseMessage

func ParseMessage(rawMessage string) Message

type MessageType

type MessageType string
const (
	Connect MessageType = "0"
	Body    MessageType = "1"
	Close   MessageType = "2"
)

Jump to

Keyboard shortcuts

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