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 ¶
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
type MessageType ¶
type MessageType string
const ( Connect MessageType = "0" Body MessageType = "1" Close MessageType = "2" )
Click to show internal directories.
Click to hide internal directories.