sender

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sender provides an object and queue consumer that can send outbound ActivityPub activities from an outbox to actor's inbox URLs. It automatically signs activities using the sending actor's private key.

Index

Constants

View Source
const OutboxSendToAllRecipients = "Outbox:SendToAllRecipients"

OutboxSendToAllRecipients is the name of the task that scans an outbound ActivityPub activity for recipients' inbox URLs, then queues additional tasks to send that activity to each recipient

View Source
const OutboxSendToSingleRecipient = "Outbox:SendToSingleRecipient"

OutboxSendToSingleRecipient is the name of the task that sends an outbound ActivityPub activity to a single recipient.

Variables

This section is empty.

Functions

func Consumer

func Consumer(sender Sender) queue.Consumer

Consumer returns a turbine queue.Consumer that processes outbound ActivityPub actitities for this outbox.

Types

type Actor

type Actor interface {

	// ActorID returns the unique ID (URL) of this Actor
	ActorID() string

	// PrivateKey returns a PrivateKeyID and PrivateKey to use for
	// signing outbound ActivityPub messages from this Actor
	PrivateKey() (privateKeyID string, privateKey crypto.PrivateKey)
}

Actor defines the interface for an ActivityPub Actor Actors must be addressable https://www.w3.org/TR/activitypub/#actors

func NewActor

func NewActor(actorID string, publicKeyID string, privateKey crypto.PrivateKey) Actor

type Locator

type Locator interface {

	// Actor retrieves a single Actor by its URL.
	Actor(url string) (Actor, error)

	// Recipients a RangeFunc iterator that containing the
	// inbox URLs for every actor that is addressed by
	// the provided URLs.
	// This method should look up individual actors, as well
	// as collections (such as Followers, Circles, etc.)
	// This method is not expected to de-duplicate inbox adddresses;
	// this action will be performed by the Outbox itself.
	Recipient(url string) (iter.Seq[string], error)
}

Locator defines a service that can locate ActivityPub actors and collections based on their URLs

type Sender

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

Sender manages delivery of outbound activities from the outbox, using the turbind Queue to deliver activities asynchronously. This object can be used on its own, or it can be embedded in the HTTPPoster object to automatically send activities when they are POST-ed to the outbox.

func New

func New(locator Locator, q *queue.Queue) Sender

New returns a fully initialized Sender object

func (Sender) Send

func (sender Sender) Send(activity mapof.Any) error

Send queues a new task to deliver the provided activity to all recipients. IMPORTANT: The queue.Consumer in this package MUST be connected to a live queue process in order for outbound activities to be sent.

func (*Sender) SendToAllRecipients added in v0.15.1

func (sender *Sender) SendToAllRecipients(activity mapof.Any) queue.Result

SendToAllRecipients sends a single ActivityPub activity from a the provided Actor to a single recipient's inbox URL.

func (*Sender) SendToSingleRecipient added in v0.15.1

func (sender *Sender) SendToSingleRecipient(args mapof.Any) queue.Result

SendToSingleRecipient sends a single ActivityPub activity from a the provided Actor to a single recipient's inbox URL.

Jump to

Keyboard shortcuts

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