pushsender

package
v1.168.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pushsender delivers A2A push notifications to client webhooks.

It replaces the SDK's push.HTTPPushSender, which posts synchronously on the task event path, honors environment proxies even when its SSRF guard is on (the dial-time IP check then validates the proxy, not the webhook), and logs raw URL errors that can include signed query strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedactURL

func RedactURL(raw string) string

RedactURL keeps only scheme and host: paths and queries of webhook URLs often carry signatures or tokens.

Types

type Config

type Config struct {
	// AllowPrivateNetworks disables the SSRF guard so webhooks may resolve to
	// loopback/private/link-local addresses. Environment proxies are only
	// honored in this mode.
	AllowPrivateNetworks bool
	// Timeout bounds a single delivery attempt. Defaults to 10s.
	Timeout time.Duration
	// QueueSize bounds pending notifications per (task, config). Beyond it,
	// intermediate events are dropped; final ones (terminal, input or auth
	// required) evict the oldest intermediate one. Defaults to 64.
	QueueSize int
	// MaxConcurrent bounds in-flight HTTP deliveries. Defaults to 8.
	MaxConcurrent int
	// Logger receives delivery failures. Defaults to slog.Default().
	Logger *slog.Logger
	// contains filtered or unexported fields
}

Config configures a Sender.

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender is an asynchronous push.Sender. SendPush serializes the event and enqueues it; per-(task, config) order is preserved and a slow webhook never delays task processing.

func New

func New(cfg Config) *Sender

New creates a Sender. Call Close to drain pending deliveries.

func (*Sender) Close

func (s *Sender) Close(ctx context.Context) error

Close stops accepting notifications and waits for pending ones until ctx is done, then aborts the remaining deliveries.

func (*Sender) SendPush

func (s *Sender) SendPush(ctx context.Context, config *a2a.PushConfig, event a2a.Event) error

SendPush implements push.Sender. It never blocks on the network and always returns nil: delivery failures are logged, not propagated to the task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL