Documentation
¶
Overview ¶
Package webhook owns the optional HTTP surface for health, metrics and provider webhooks.
Index ¶
Constants ¶
const (
DefaultMaxBodyBytes = 64 * 1024
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ListenAddr string
MetricsEnabled bool
TributeEnabled bool
TelegramEnabled bool
TributePath string
TelegramPath string
MaxBodyBytes int64
ReadHeaderTimeout time.Duration
ReadTimeout time.Duration
ShutdownTimeout time.Duration
Readiness Readiness
Metrics *Metrics
Tribute http.Handler
Telegram http.Handler
Logger *slog.Logger
}
Config controls the optional HTTP server.
type Readiness ¶
type Readiness struct {
DB *sql.DB
HealthKeys []string
ReconcileInterval time.Duration
GetMeOK func() bool
RequireTelegramWebhookRegistration bool
TelegramWebhookRegistered func() bool
Now func() time.Time
}
Readiness contains dependencies used by /readyz.
type ReadinessResult ¶
ReadinessResult is the machine-readable readiness decision.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an optional HTTP runtime.
type TelegramHandler ¶
type TelegramHandler struct {
Secret string
Processor TelegramProcessor
}
TelegramHandler accepts Telegram webhook updates.
func NewTelegramHandler ¶
func NewTelegramHandler(secret string, processor TelegramProcessor) *TelegramHandler
NewTelegramHandler returns a Telegram webhook handler.
func (*TelegramHandler) ServeHTTP ¶
func (h *TelegramHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP verifies Telegram's secret token before reading the update.
type TelegramProcessor ¶
TelegramProcessor is the durable Telegram webhook processing surface.
type TributeHandler ¶
type TributeHandler struct {
DB *sql.DB
APIKey string
Engine *engine.Engine
CancelImmediate bool
OwnerIDs []int64
AdminLogChatID *int64
OperatorLog *operatorlog.Writer
Logger *slog.Logger
}
TributeHandler accepts Tribute webhooks.
func (*TributeHandler) ServeHTTP ¶
func (h *TributeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP validates and processes one Tribute webhook.