Documentation
¶
Overview ¶
Package notify delivers completed investigations to chat (Slack, Matrix).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(inv providers.Investigation) string
Format renders an Investigation as a concise markdown-ish message used by all notifiers.
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix delivers via the Matrix client-server send API.
func NewMatrix ¶
NewMatrix builds a Matrix notifier. homeserver is the base URL (e.g. https://matrix.org); roomID is like "!abc:hs"; token is an access token.
The txn counter is seeded from the wall clock (UnixNano) rather than 0 so that transaction ids keep increasing across process restarts. Homeservers dedupe by (access_token, txnId); a fresh process starting back at "runlore-1" could otherwise collide with a pre-restart id and have its message silently dropped. Caveat: a backwards wall-clock jump across a restart could still collide — an acceptable residual given the dedup window is minutes and the prior behaviour offered zero protection.
func (*Matrix) Deliver ¶
Deliver sends the formatted investigation as an m.notice message. It carries both a plaintext body (the fallback Matrix renders literally) and a rich formatted_body (org.matrix.custom.html) so the message's mrkdwn renders as bold/links/code instead of leaking raw *asterisks* to Matrix clients.
type Multi ¶
type Multi struct {
// contains filtered or unexported fields
}
Multi delivers to several notifiers, best-effort: a failing notifier is logged, not propagated, so one bad sink doesn't block the others.
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
Slack delivers via a Slack incoming webhook.
type SlackBot ¶
type SlackBot struct {
// contains filtered or unexported fields
}
SlackBot delivers via the Slack Web API (chat.postMessage) using a bot token, for workspaces that provision a bot app instead of an incoming webhook. Unlike a webhook, chat.postMessage targets an explicit channel and returns HTTP 200 with {"ok":false,"error":...} on logical failures (e.g. not_in_channel).
func NewSlackBot ¶
NewSlackBot builds a bot-token Slack notifier posting to channel (ID or name).