Documentation
¶
Overview ¶
Package notify sends through the channels that are not the Feishu app: Pushover (iOS emergency alerts that repeat until acknowledged), Bark (an iOS push that rings), the Feishu group's custom bot (plain messages that need no app and spend no API quota), signed team webhooks, and healthchecks.io pings.
Index ¶
- func Ping(ctx context.Context, hc *http.Client, checkURL string, ok bool) error
- func Sign(timestamp, secret string) string
- func SignWebhook(secret string, body []byte) string
- func SlackMessage(heading, incidentURL, openLabel string) []byte
- func ValidSlackWebhookURL(raw string) bool
- func ValidWebhookURL(raw string) bool
- type Bark
- type Emergency
- type GroupBot
- type Pushover
- type Receipt
- type Slack
- type SlackRateLimited
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sign ¶
Sign is the custom bot's signature: base64(HMAC-SHA256 with key "timestamp\nsecret" over nothing).
func SignWebhook ¶
SignWebhook returns the Beacon signature of the exact bytes sent to a webhook.
func SlackMessage ¶
SlackMessage renders a plain-text incident title with an optional, generated link. Only the link section uses Slack markup, and it contains no text from the alert itself.
func ValidSlackWebhookURL ¶
ValidSlackWebhookURL accepts the official Slack and GovSlack incoming webhook endpoints.
func ValidWebhookURL ¶
ValidWebhookURL reports whether an endpoint is an absolute HTTP(S) URL without userinfo or a fragment.
Types ¶
type Bark ¶
type Bark struct {
URL string // https://api.day.app/<key>
HTTP *http.Client
}
Bark sends an iOS push through a Bark server; critical pushes ring through silent mode.
type Emergency ¶
type Emergency struct {
Title, Message, URL, URLTitle string
}
Emergency is an emergency-priority message.
type GroupBot ¶
type GroupBot struct {
URL string
Secret string
Keyword string
HTTP *http.Client
// contains filtered or unexported fields
}
GroupBot posts plain text to a Feishu group through its custom bot. The bot's security setting is a keyword (every message must contain it) and optionally a signing secret.
type Pushover ¶
type Pushover struct {
API string // https://api.pushover.net
Token string // application token
User string // user key
Retry time.Duration
Expire time.Duration
HTTP *http.Client
Enabled bool
}
Pushover sends emergency-priority messages to one user.
func (*Pushover) Cancel ¶
Cancel stops retries for a single emergency message identified by its receipt.
type Slack ¶
type Slack struct {
URL string
// contains filtered or unexported fields
}
Slack delivers incident messages to a Slack app's incoming webhook.
type SlackRateLimited ¶
SlackRateLimited is the retry interval from a Slack rate-limit response.
func (SlackRateLimited) Error ¶
func (SlackRateLimited) Error() string