common

package
v0.23.13 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func FormatMessage

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

func NewRandomUUID added in v0.23.13

func NewRandomUUID() string

NewRandomUUID returns a cryptographically random RFC 4122 version 4 UUID. The process cannot safely continue if the operating system entropy source fails, so this follows the fail-fast behavior of the UUID helper it replaces.

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

ParseMessage preserves the historical one-result API. Malformed input now returns a zero value instead of panicking; security-sensitive callers should use ParseMessageSafe to inspect the validation error.

func ParseMessageSafe added in v0.23.13

func ParseMessageSafe(rawMessage string) (Message, error)

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