Documentation
¶
Overview ¶
Package notify sends findings to somewhere outside this machine.
It is the only part of LAN Sheriff that does so, and the only part that can ever cause information about a network to reach a third party. Everything here is shaped by that:
- **Off unless configured.** No target has a default. An unset target is not a disabled feature, it is an absent one.
- **The payload is deliberately thin.** A notification says which rule fired and what it fired about, and nothing else. It does not carry the organization, the address, the interval, or the counts, those live in the dashboard, behind the user's own authentication. A push notification travels through somebody else's server and often ends up on a lock screen.
- **It cannot delay observation.** Sending happens on its own goroutine with a short timeout; a webhook that hangs must never slow down capture.
- **It fails quietly and does not retry.** A missed notification is a small loss. A retry storm against somebody's server, from a tool that is supposed to be unobtrusive, is a much larger one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Discord ¶
type Discord struct{ URL string }
Discord posts to an incoming webhook.
func NewDiscord ¶
type Finding ¶
type Finding struct {
// Rule is the stable code, such as "beaconing".
Rule string
// Subject is the device's display name, or its address if it has no name.
Subject string
// Score is the finding's weight, so a recipient can filter.
Score float64
At time.Time
}
Finding is the thin shape a notification carries.
Deliberately not the store's Finding: this is what leaves the machine, and it should be obvious from the type alone exactly how much that is.
type Notifier ¶
type Notifier struct {
Targets []Target
// MinScore suppresses notifications below a threshold, so a channel can be
// set to carry only what matters.
MinScore float64
// contains filtered or unexported fields
}
Notifier fans a finding out to every configured target.
type Webhook ¶
type Webhook struct{ URL string }
Webhook posts a small JSON object to any endpoint.
The general case, and the one to prefer: it goes wherever the user chooses rather than through a third party's infrastructure.