Documentation
¶
Overview ¶
Package envelope defines the immutable message envelope (RFC 5.1) and the limits checked at ingress.
Index ¶
Constants ¶
const ( MaxBody = 32 << 10 MaxData = 64 << 10 MaxAttachment = 25 << 20 MaxAttachmentTotal = 100 << 20 MaxSubject = 512 MaxSummary = 280 )
Limits from RFC 5.1.
const ( OriginInteractive = "interactive" OriginWorker = "worker" OriginCLI = "cli" OriginHuman = "human" OriginDaemon = "daemon" )
Origins of a message (RFC 4.5).
Variables ¶
This section is empty.
Functions ¶
func SanitizeName ¶
SanitizeName turns any string into a safe file name.
Types ¶
type Attachment ¶
type Attachment struct {
Name string `json:"name"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
MIME string `json:"mime"`
}
Attachment is a content-addressed blob reference.
type Draft ¶
type Draft struct {
To string `json:"to"`
Kind string `json:"kind"`
Intent string `json:"intent"`
Priority string `json:"priority,omitempty"`
Subject string `json:"subject"`
Body string `json:"body,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
DedupeKey string `json:"dedupe_key,omitempty"`
Deadline *time.Time `json:"deadline,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
}
Draft is what a client submits. It has no id, thread, sender or hop: those are minted or stamped by the daemon.
type Envelope ¶
type Envelope struct {
ID string `json:"id"`
ThreadID string `json:"thread_id"`
ParentID *string `json:"parent_id"`
From From `json:"from"`
To string `json:"to"`
Kind string `json:"kind"`
Intent string `json:"intent"`
Priority string `json:"priority"`
Subject string `json:"subject"`
Body string `json:"body"`
Data json.RawMessage `json:"data,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
DedupeKey string `json:"dedupe_key,omitempty"`
Hop int `json:"hop"`
Deadline *time.Time `json:"deadline,omitempty"`
CreatedAt time.Time `json:"created_at"`
// Status is set on replies: "ok", "timeout", "rejected", "failed".
Status string `json:"status,omitempty"`
}
Envelope is the message as stored and handed to handlers.