remote

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Overview

Package remote runs community adapters: sending adapters that live in their own process and speak the adapter protocol (docs/adapters.md, "Community adapters"), signed JSON over HTTP(S). A Provider proxies every providers.Provider call to the adapter process and implements exactly the optional interfaces the installed manifest declares, so core code sees a community adapter like a built-in one. The Runtime registers installed adapters as "community:<id>" and keeps them in step with the database.

Index

Constants

View Source
const (
	BreakerThreshold   = 5
	BreakerCooldown    = 30 * time.Second
	BreakerMaxCooldown = 5 * time.Minute
)

Circuit breaker settings: after BreakerThreshold adapter failures in a row, calls fail at once for BreakerCooldown (doubling up to BreakerMaxCooldown while probes keep failing).

View Source
const (
	BreakerClosed   = "closed"
	BreakerOpen     = "open"
	BreakerHalfOpen = "half_open"
)

Breaker states.

View Source
const (
	OpHealth           = "health"
	OpVerify           = "verify"
	OpSend             = "send"
	OpWebhookVerify    = "webhooks/verify"
	OpWebhookParse     = "webhooks/parse"
	OpWebhookRegister  = "webhooks/register"
	OpDomainAdd        = "domains/add"
	OpDomainStatus     = "domains/status"
	OpQuota            = "quota"
	OpSuppressionsList = "suppressions/list"
	OpSuppressionsAdd  = "suppressions/add"
)

Operations of the adapter protocol (POST /v1/<operation>).

View Source
const (
	// MaxSendRequest is the largest send request ReputeCast builds; larger
	// batches are split into several calls.
	MaxSendRequest = 24 << 20
	// MaxSuppressionPages bounds one pull of the provider's suppressions.
	MaxSuppressionPages = 100
	// SuppressionPushBatch is the most addresses per suppressions/add call.
	SuppressionPushBatch = 500
)

Limits of the protocol.

View Source
const (
	CodeInvalidRequest      = "invalid_request"
	CodeUnauthenticated     = "unauthenticated"
	CodeTooLarge            = "too_large"
	CodeBadSignature        = "bad_signature"
	CodeProviderThrottled   = "provider_throttled"
	CodeProviderAuth        = "provider_auth"
	CodeProviderError       = "provider_error"
	CodeProviderUnavailable = "provider_unavailable"
	CodeNotSupported        = "not_supported"
	CodeInternal            = "internal"
)

Error codes.

View Source
const (
	HeaderProtocol    = "X-ReputeCast-Protocol"
	HeaderTimestamp   = "X-ReputeCast-Timestamp"
	HeaderSignature   = "X-ReputeCast-Signature"
	HeaderOperation   = "X-ReputeCast-Operation"
	HeaderIdempotency = "Idempotency-Key"
)

Headers of the protocol.

View Source
const Kind = "remote"

Kind is the installed_adapters.kind and manifest "kind" of adapters that run in their own process and speak this protocol.

View Source
const MaxBatch = 1000

MaxBatch is the largest batch an adapter may declare.

View Source
const MaxInFlight = 64

MaxInFlight is how many calls may run against one adapter at a time.

View Source
const MaxSkew = 5 * time.Minute

MaxSkew is how far a signed timestamp may be from the receiver's clock.

View Source
const MessageHeader = "X-ReputeCast-Message"

MessageHeader carries the ReputeCast message id on every message.

View Source
const PreviousSecretGrace = 24 * time.Hour

PreviousSecretGrace is how long the previous signing secret keeps working after a new one is issued.

View Source
const ProtocolVersion = 1

ProtocolVersion is the adapter protocol version this build speaks.

View Source
const SecretPrefix = "rcas_"

SecretPrefix starts every adapter signing secret.

View Source
const SyncInterval = 15 * time.Second

SyncInterval is how often every process re-reads the installed adapters, so an install, update or removal made by another process (or the CLI) reaches it.

Variables

View Source
var (
	ErrNoSignature    = errors.New("the request or response is not signed")
	ErrStaleTimestamp = errors.New("the signature's timestamp is more than 5 minutes off")
	ErrBadSignature   = errors.New("the signature doesn't match")
)

Signature errors.

View Source
var CLIActor = &audit.Actor{Type: authz.ActorSystem, Name: "CLI (server)"}

CLIActor is the audit actor of the server CLI.

Functions

func CheckEndpoint

func CheckEndpoint(raw string, allowPrivate bool) (string, error)

CheckEndpoint validates an adapter address: an absolute http(s) URL without credentials, query or fragment. Without allowPrivate it must be https:// and public; with it, http:// is accepted for addresses that turn out to be loopback or private when connecting.

func NewSecret

func NewSecret() string

NewSecret returns a fresh signing secret: "rcas_" and 32 random bytes.

func Operations

func Operations(c Capabilities) []string

Operations returns the operations a manifest lets ReputeCast call, in protocol order.

func Register

func Register(h huma.API, s *Service)

Register adds the community adapter runtime operations. Adapters apply to every workspace, so on top of providers:manage they need an instance admin, like installing one.

func SecretAD

func SecretAD(adapterID uuid.UUID) string

SecretAD is the associated data sealing an installed adapter's signing secret (the current and the previous one).

func Sign

func Sign(secret string, timestamp int64, body []byte) string

Sign returns the lowercase hex HMAC-SHA256 of "<timestamp>.<body>".

func SignatureHeader

func SignatureHeader(secrets []string, timestamp int64, body []byte) string

SignatureHeader is the X-ReputeCast-Signature value: one "v1=" entry per secret, current first.

func Verify

func Verify(secrets []string, timestamp, header string, body []byte, now time.Time) error

Verify checks a timestamp and signature header against any of the secrets.

Types

type AdapterRuntime

type AdapterRuntime struct {
	AdapterID string `json:"adapterId" format:"uuid"`
	// Adapter is the registry key: "community:<id>".
	Adapter string `json:"adapter" example:"community:example-esp"`
	Name    string `json:"name"`
	Version string `json:"version" doc:"Version of the installed manifest"`
	// EndpointURL is where the adapter process listens ("" until it is set).
	EndpointURL string `json:"endpointUrl"`
	// EndpointProblem explains why the stored address is refused.
	EndpointProblem          string     `json:"endpointProblem,omitempty"`
	SecretIssuedAt           time.Time  `json:"secretIssuedAt"`
	PreviousSecretValidUntil *time.Time `json:"previousSecretValidUntil,omitempty"`
	// Operations are the protocol operations ReputeCast may call, from the
	// declared capabilities.
	Operations   []string `json:"operations"`
	Capabilities []string `json:"capabilities"`
	// Network lists the hosts the manifest declares.
	Network []string `json:"network"`
	// Breaker is this process's circuit breaker for the adapter.
	Breaker          string     `json:"breaker" enum:"closed,open,half_open"`
	BreakerOpenUntil *time.Time `json:"breakerOpenUntil,omitempty"`
	LastFailure      string     `json:"lastFailure,omitempty"`
	// Registered is true when this process has the adapter in its registry.
	Registered bool                 `json:"registered"`
	Check      *AdapterRuntimeCheck `json:"check,omitempty"`
	Connected  int64                `json:"connected" doc:"Connected providers using the adapter, in every workspace"`
}

AdapterRuntime is the runtime of an installed community adapter, for instance admins. The signing secret is never returned.

type AdapterRuntimeCheck

type AdapterRuntimeCheck struct {
	At             time.Time `json:"at"`
	OK             bool      `json:"ok"`
	Detail         string    `json:"detail"`
	RunningVersion string    `json:"runningVersion,omitempty"`
}

AdapterRuntimeCheck is the last health check of the adapter process.

type AdapterRuntimeInput

type AdapterRuntimeInput struct {
	EndpointURL string `json:"endpointUrl" minLength:"8" maxLength:"2048" doc:"Base URL of the adapter process, like http://example-esp:4600"`
}

AdapterRuntimeInput sets where the adapter process listens.

type AdapterRuntimeSecret

type AdapterRuntimeSecret struct {
	Secret string `` /* 132-byte string literal not displayed */
	// PreviousSecretValidUntil is when the previous secret stops working.
	PreviousSecretValidUntil *time.Time `json:"previousSecretValidUntil,omitempty"`
}

AdapterRuntimeSecret carries a new signing secret, shown once.

type Address

type Address struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

Address is a mailbox.

type Capabilities

type Capabilities struct {
	Batch            int
	Webhooks         bool
	RegisterWebhooks bool
	DomainSetup      string // "", "full", "dkim_only"
	SuppressionSync  string // "", "pull", "push", "two-way"
	QuotaDiscovery   string // "", "quota", "rate"
	Sandbox          string // "", "detection", "test token", "mode"
	DedicatedIPs     string
	RewritesLinks    bool
	AddsOpenPixel    bool
}

Capabilities are what an adapter declares it can do; ReputeCast calls the operations they enable and nothing else. In JSON the string-or-false values are false when absent.

func (Capabilities) MarshalJSON

func (c Capabilities) MarshalJSON() ([]byte, error)

MarshalJSON writes the capabilities object as the manifest spells it.

func (Capabilities) Pull

func (c Capabilities) Pull() bool

Pull reports whether ReputeCast pulls the provider's suppressions.

func (Capabilities) Push

func (c Capabilities) Push() bool

Push reports whether ReputeCast pushes the shared list to the provider.

func (*Capabilities) UnmarshalJSON

func (c *Capabilities) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the capabilities object strictly: unknown keys and values of the wrong type are errors, so a typo never drops a capability.

type Connection

type Connection struct {
	ProviderID    string         `json:"providerId"`
	WorkspaceID   string         `json:"workspaceId"`
	Settings      map[string]any `json:"settings"`
	Credentials   map[string]any `json:"credentials"`
	WebhookSecret string         `json:"webhookSecret,omitempty"`
}

Connection is the connected provider a call is for.

type DomainInput

type DomainInput struct {
	Domain string `json:"domain"`
}

DomainInput is the domains/add and domains/status input.

type DomainOutput

type DomainOutput struct {
	Records []providers.DNSRecord `json:"records"`
}

DomainOutput is their result.

type Envelope

type Envelope struct {
	Protocol       int         `json:"protocol"`
	Operation      string      `json:"operation"`
	Adapter        string      `json:"adapter"`
	IdempotencyKey string      `json:"idempotencyKey"`
	Deadline       string      `json:"deadline"`
	Connection     *Connection `json:"connection,omitempty"`
	Input          any         `json:"input"`
}

Envelope is the body of every request ReputeCast sends.

type Field

type Field struct {
	Key      string   `json:"key"`
	Label    string   `json:"label"`
	Secret   bool     `json:"secret,omitempty"`
	Required bool     `json:"required,omitempty"`
	Options  []string `json:"options,omitempty"`
	Help     string   `json:"help,omitempty"`
}

Field is one input of the connection form.

type HealthOutput

type HealthOutput struct {
	Adapter      string          `json:"adapter"`
	Version      string          `json:"version"`
	Protocol     int             `json:"protocol"`
	SDK          string          `json:"sdk,omitempty"`
	Capabilities json.RawMessage `json:"capabilities,omitempty"`
}

HealthOutput is the health result.

type InstallResult

type InstallResult struct {
	Row     store.RemoteAdapterGetRow
	Updated bool
	// Secret is the new signing secret on a first install ("" on update).
	Secret string
}

InstallResult is what the CLI prints after an install.

type Installation

type Installation struct {
	// ID is the installed_adapters row.
	ID       uuid.UUID
	Manifest Manifest
	// Endpoint is the adapter process's base URL ("" until it is set).
	Endpoint string
	// PublicURL is ReputeCast's public base URL, used to rebuild the URL of
	// forwarded webhooks.
	PublicURL string
	// contains filtered or unexported fields
}

Installation is one installed community adapter as the runtime sees it: its manifest, where its process listens and the secrets that sign the calls. Every connection made through the adapter shares it, with its HTTP client, its concurrency limit and its circuit breaker.

func NewInstallation

func NewInstallation(o Options) (*Installation, error)

NewInstallation builds an installation. The endpoint is checked again at every connection: its address must be allowed by the network policy, and plain http:// only reaches loopback and private addresses.

func (*Installation) BreakerState

func (in *Installation) BreakerState() (string, time.Time, string)

BreakerState describes the circuit breaker: closed, open (until when) or half_open, and the last adapter failure.

func (*Installation) Health

func (in *Installation) Health(ctx context.Context) (HealthOutput, error)

Health calls the adapter's health operation and checks it is the adapter that was installed. It goes out even while the circuit breaker is open.

func (*Installation) Open

Open returns the provider for a connection made through the installation. Its method set matches the manifest: QuotaReporter, SuppressionSyncer, DomainManager and WebhookRegistrar are only implemented when the corresponding capability is declared, because core code decides what to do from the interfaces a provider implements.

type KindDescriptor

type KindDescriptor func(key, name, version, maintainer string, manifest []byte) (providers.Descriptor, error)

KindDescriptor builds the registry entry of an installed adapter of a kind other than "remote" (the app wires the generic HTTP adapter's httpgeneric.CommunityDescriptor for "http"). key is providers.CommunityKey(name).

type Manifest

type Manifest struct {
	Protocol     int          `json:"protocol"`
	Kind         string       `json:"kind"`
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	Version      string       `json:"version"`
	Maintainer   string       `json:"maintainer"`
	Description  string       `json:"description,omitempty"`
	Homepage     string       `json:"homepage,omitempty"`
	SourceURL    string       `json:"source_url,omitempty"`
	LastRelease  string       `json:"last_release,omitempty"`
	Latest       string       `json:"latest_version,omitempty"`
	Capabilities Capabilities `json:"capabilities"`
	Terms        Terms        `json:"terms"`
	Pricing      string       `json:"pricing"`
	Config       []Field      `json:"config"`
	Permissions  Permissions  `json:"permissions"`
}

Manifest is a community adapter's manifest.json (kind "remote").

func ParseManifest

func ParseManifest(raw []byte) (Manifest, error)

ParseManifest reads and validates a manifest of kind "remote". Errors are sentences that can be shown to the person installing the adapter.

func (Manifest) Descriptor

func (m Manifest) Descriptor(newFn func(providers.Config) (providers.Provider, error)) providers.Descriptor

Descriptor describes the adapter for the catalog; newFn builds a provider.

func (Manifest) Fields

func (m Manifest) Fields() []providers.Field

Fields is the connection form.

func (Manifest) Key

func (m Manifest) Key() string

Key is the registry key of the adapter: "community:<id>".

func (Manifest) Labels

func (m Manifest) Labels() []string

Labels are the declared capabilities as the Adapters tab lists them ("webhooks · suppression pull · batch 50"), in English.

func (Manifest) LabelsIn

func (m Manifest) LabelsIn(l i18n.Lang) []string

LabelsIn are the declared capabilities in the reader's language.

func (Manifest) ProviderCapabilities

func (m Manifest) ProviderCapabilities() providers.Capabilities

ProviderCapabilities maps the declaration to the capability badges.

func (Manifest) ProviderTerms

func (m Manifest) ProviderTerms() []providers.Terms

ProviderTerms is what the terms allow, per stream.

func (*Manifest) Validate

func (m *Manifest) Validate() error

type Options

type Options struct {
	ID       uuid.UUID
	Manifest Manifest
	Endpoint string
	// Secrets sign requests and verify responses: the current secret first,
	// then the previous one while it is still valid.
	Secrets []string
	// AllowPrivate lets the endpoint resolve to loopback and private
	// addresses (providers.allow_private_networks).
	AllowPrivate bool
	PublicURL    string
	// HTTP overrides the client (tests); by default calls go through a
	// netguard client built for the endpoint.
	HTTP *http.Client
	Now  func() time.Time
	Log  *slog.Logger
	// contains filtered or unexported fields
}

Options configure an installation.

type Permissions

type Permissions struct {
	// Network lists hosts: "api.example.com", "*.example.com", "host:port"
	// or "settings:<key>" for the host of a URL entered in the connection form.
	Network []string `json:"network,omitempty"`
}

Permissions are what the adapter process may reach.

type RegisterInput

type RegisterInput struct {
	URL string `json:"url"`
}

RegisterInput is the webhooks/register input.

type Response

type Response struct {
	Protocol       int             `json:"protocol"`
	IdempotencyKey string          `json:"idempotencyKey"`
	Result         json.RawMessage `json:"result,omitempty"`
	Error          *WireError      `json:"error,omitempty"`
}

Response is the body of every answer.

type Runtime

type Runtime struct {
	Pool *pgxpool.Pool
	Box  *secrets.Box
	Log  *slog.Logger
	// AllowPrivate reports providers.allow_private_networks; read at each sync.
	AllowPrivate func() bool
	// PublicURL is ReputeCast's public base URL (forwarded webhook URLs).
	PublicURL func() string
	Now       func() time.Time
	// HTTP overrides every installation's client (tests).
	HTTP *http.Client
	// Interval overrides SyncInterval.
	Interval time.Duration
	// Kinds registers installed adapters of other kinds ("http").
	Kinds map[string]KindDescriptor
	// contains filtered or unexported fields
}

Runtime keeps the provider registry in step with the installed community adapters: kind "remote" as "community:<id>", proxied to the adapter process, and the kinds in Kinds as "community:<name>". It implements manage.CommunityRuntime.

func (*Runtime) Changed

func (rt *Runtime) Changed(ctx context.Context)

Changed implements manage.CommunityRuntime: it re-registers the installed adapters after an install, update or removal is committed.

func (*Runtime) Installation

func (rt *Runtime) Installation(key string) (*Installation, bool)

Installation returns a registered installation by key ("community:<id>").

func (*Runtime) Installed

func (rt *Runtime) Installed(ctx context.Context, tx pgx.Tx, adapterID uuid.UUID, raw []byte) error

Installed implements manage.CommunityRuntime: inside the transaction that installs an adapter it creates the runtime row with a new signing secret, sealed (an instance admin issues one to read with `reputecast adapter secret`, and sets the address with `reputecast adapter set-url`).

func (*Runtime) ParseManifest

func (rt *Runtime) ParseManifest(raw []byte, l i18n.Lang) (string, []string, error)

ParseManifest implements manage.CommunityRuntime: it validates a manifest of kind "remote" and returns its registry key and the capabilities the Adapters tab lists, in the reader's language.

func (*Runtime) Start

func (rt *Runtime) Start(ctx context.Context)

Start registers the installed adapters and keeps them in step every SyncInterval until Stop or until the database pool is closed. A first sync that fails (for example before migrations ran) is retried by the loop.

func (*Runtime) Stop

func (rt *Runtime) Stop()

Stop ends the sync loop and waits for a sync in progress to finish. A runtime stopped before Start never starts its loop; Sync and Changed keep working.

func (*Runtime) Sync

func (rt *Runtime) Sync(ctx context.Context) error

Sync reads the installed community adapters and registers them: remote adapters, and the kinds in Kinds. A row that can't be used (a manifest that no longer validates, a secret that can't be opened, a key another adapter already has) is skipped and reported; the others are registered.

type SendInput

type SendInput struct {
	Messages []WireMessage `json:"messages"`
}

SendInput is the send operation's input.

type SendOutput

type SendOutput struct {
	Results []WireSendResult `json:"results"`
}

SendOutput is the send operation's result.

type Service

type Service struct {
	Pool    *pgxpool.Pool
	Q       *store.Queries
	Audit   *audit.Logger
	Box     *secrets.Box
	Runtime *Runtime
	// AllowPrivate reports providers.allow_private_networks.
	AllowPrivate func() bool
	Now          func() time.Time
}

Service manages the runtime of installed community adapters: where each process listens, its signing secret and its health. The Adapters tab's install, update and remove (internal/providers/manage) cover the rest; the server CLI (`reputecast adapter`) uses this service for everything.

func (*Service) Check

Check calls the adapter's health operation now and records the result (audited like a provider check).

func (*Service) Install

func (s *Service) Install(ctx context.Context, raw []byte, source, endpoint string, actor *audit.Actor) (InstallResult, error)

Install installs a remote adapter from its manifest, or updates the manifest when its id is already installed (server CLI). source is where the manifest came from ("" for a local file).

func (*Service) IssueSecret

func (s *Service) IssueSecret(ctx context.Context, wsID *uuid.UUID, r store.RemoteAdapterGetRow, actor *audit.Actor) (AdapterRuntimeSecret, error)

IssueSecret replaces the signing secret and returns the new one, once. The previous secret keeps working for PreviousSecretGrace.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]AdapterRuntime, error)

List describes every installed remote adapter.

func (*Service) Remove

func (s *Service) Remove(ctx context.Context, r store.RemoteAdapterGetRow, actor *audit.Actor) error

Remove uninstalls a remote adapter no connected provider uses (server CLI; the Adapters tab uses manage.RemoveAdapter).

func (*Service) RowByKey

func (s *Service) RowByKey(ctx context.Context, idOrKey string) (store.RemoteAdapterGetRow, error)

RowByKey finds an installed remote adapter by its id or registry key.

func (*Service) SetEndpoint

func (s *Service) SetEndpoint(ctx context.Context, wsID *uuid.UUID, r store.RemoteAdapterGetRow, endpoint string, actor *audit.Actor) (store.RemoteAdapterGetRow, error)

SetEndpoint sets where the adapter process listens. actor is nil for people (taken from the request) or CLIActor; wsID is the workspace the change was made from, nil from the CLI.

func (*Service) View

View describes an installed adapter's runtime.

type SuppressionsAddInput

type SuppressionsAddInput struct {
	Emails []string `json:"emails"`
}

SuppressionsAddInput is the suppressions/add input.

type SuppressionsListInput

type SuppressionsListInput struct {
	Since  *string `json:"since"`
	Cursor *string `json:"cursor"`
}

SuppressionsListInput is the suppressions/list input.

type SuppressionsListOutput

type SuppressionsListOutput struct {
	Suppressions []WireSuppression `json:"suppressions"`
	NextCursor   *string           `json:"nextCursor"`
}

SuppressionsListOutput is its result.

type Terms

type Terms struct {
	BulkMarketing providers.BulkPolicy `json:"bulkMarketing"`
	Note          string               `json:"note,omitempty"`
	URL           string               `json:"url,omitempty"`
}

Terms is what the provider's terms allow.

type WebhookParseInput

type WebhookParseInput struct {
	Request  WebhookRequest `json:"request"`
	Verified bool           `json:"verified"`
}

WebhookParseInput is the webhooks/parse input.

type WebhookParseOutput

type WebhookParseOutput struct {
	Events []WireEvent `json:"events"`
}

WebhookParseOutput is the webhooks/parse result.

type WebhookRequest

type WebhookRequest struct {
	Method  string              `json:"method"`
	URL     string              `json:"url"`
	Headers map[string][]string `json:"headers"`
	// Body is the raw body (base64 in JSON).
	Body []byte `json:"body"`
}

WebhookRequest is a provider webhook forwarded to the adapter.

type WebhookVerifyInput

type WebhookVerifyInput struct {
	Request WebhookRequest `json:"request"`
}

WebhookVerifyInput is the webhooks/verify input.

type WebhookVerifyOutput

type WebhookVerifyOutput struct {
	Handshake *struct {
		Body string `json:"body"`
	} `json:"handshake,omitempty"`
}

WebhookVerifyOutput is the webhooks/verify result.

type WireError

type WireError struct {
	Code         string  `json:"code"`
	Message      string  `json:"message"`
	Status       int     `json:"status,omitempty"`
	ProviderCode string  `json:"providerCode,omitempty"`
	RetryAfter   float64 `json:"retryAfter,omitempty"`
}

WireError is a failed operation.

type WireEvent

type WireEvent struct {
	Type              string          `json:"type"`
	Recipient         string          `json:"recipient"`
	ProviderMessageID string          `json:"providerMessageId,omitempty"`
	MessageID         string          `json:"messageId,omitempty"`
	OccurredAt        string          `json:"occurredAt"`
	OriginalType      string          `json:"originalType,omitempty"`
	OriginalCode      string          `json:"originalCode,omitempty"`
	Diagnostic        string          `json:"diagnostic,omitempty"`
	BounceClass       string          `json:"bounceClass,omitempty"`
	URL               string          `json:"url,omitempty"`
	UserAgent         string          `json:"userAgent,omitempty"`
	Raw               json.RawMessage `json:"raw"`
}

WireEvent is a normalized provider event.

type WireMessage

type WireMessage struct {
	ID      string            `json:"id"`
	Stream  string            `json:"stream"`
	From    Address           `json:"from"`
	ReplyTo *Address          `json:"replyTo,omitempty"`
	To      Address           `json:"to"`
	Subject string            `json:"subject"`
	HTML    string            `json:"html,omitempty"`
	Text    string            `json:"text,omitempty"`
	Headers map[string]string `json:"headers"`
	Tags    map[string]string `json:"tags,omitempty"`
}

WireMessage is one message to send.

type WireQuota

type WireQuota struct {
	Kind    string  `json:"kind,omitempty"`
	Max     int64   `json:"max,omitempty"`
	Used    int64   `json:"used,omitempty"`
	MaxRate float64 `json:"maxRate,omitempty"`
	Sandbox bool    `json:"sandbox,omitempty"`
	Account string  `json:"account,omitempty"`
}

WireQuota is the quota result (and the verify result).

type WireSendError

type WireSendError struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	Temporary bool   `json:"temporary"`
	Throttled bool   `json:"throttled"`
}

WireSendError is a per-message refusal.

type WireSendResult

type WireSendResult struct {
	MessageID         string         `json:"messageId"`
	ProviderMessageID string         `json:"providerMessageId,omitempty"`
	Error             *WireSendError `json:"error,omitempty"`
}

WireSendResult is the outcome for one message.

type WireSuppression

type WireSuppression struct {
	Email     string `json:"email"`
	Reason    string `json:"reason"`
	Code      string `json:"code,omitempty"`
	CreatedAt string `json:"createdAt,omitempty"`
}

WireSuppression is one suppressed address.

Directories

Path Synopsis
Package remotetest is a fake community adapter process for tests: a small reference implementation of the adapter side of the protocol (docs/adapters.md) in Go.
Package remotetest is a fake community adapter process for tests: a small reference implementation of the adapter side of the protocol (docs/adapters.md) in Go.

Jump to

Keyboard shortcuts

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