Documentation
¶
Overview ¶
Package workers ports the bootnode background workers. It currently provides webhook delivery (the Go equivalent of bootnode/workers/webhook.py): sign a payload with the webhook's HMAC secret, POST it, and return the delivery outcome for the caller to persist.
This is a library, not a daemon. Base does not run arq; delivery is driven by the plugin (synchronously on the event, or from a Base task/scheduler). The dispatch logic — signing, timeout, retry accounting — lives here, decoupled from any queue.
Index ¶
Constants ¶
const SignatureHeader = "X-Bootnode-Signature"
SignatureHeader is the header carrying the HMAC-SHA256 signature of the body.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Delivery ¶
Delivery is the outcome of a single webhook delivery attempt. The plugin persists it to the _bootnode_webhook_deliveries collection.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher delivers signed webhook payloads.
func NewDispatcher ¶
func NewDispatcher(timeout time.Duration) *Dispatcher
NewDispatcher constructs a Dispatcher with the given per-request timeout. A zero timeout defaults to 30s (matching the Python webhook_timeout).
func (*Dispatcher) Deliver ¶
func (d *Dispatcher) Deliver(ctx context.Context, url, secret string, payload any) (*Delivery, error)
Deliver POSTs payload to url, signing it with secret. The returned Delivery records the outcome regardless of HTTP status — a non-2xx response is a delivery with Success=false, not a Go error. A Go error is returned only for payload marshaling failures (a programming error).