failover

package
v0.50.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 1 module, 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 failover composes borrowed email transports. A send moves to the next transport only after a Transient failure: a known non-acceptance. Permanent, Construction and Ambiguous outcomes stop immediately, because an ambiguous submission may already have been accepted and trying another transport could deliver the message twice.

Index

Constants

View Source
const MaxTransports = 8

MaxTransports bounds one composition.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver borrows its transports; close them after the owning mailer drains. It renders MIME for every transport, which provider API drivers accept too.

func New

func New(transports ...email.Driver) (*Driver, error)

New tries transports in order on every send.

func RoundRobin

func RoundRobin(transports ...email.Driver) (*Driver, error)

RoundRobin starts each send at the next transport in turn, spreading load, and fails over through the others in order.

func (*Driver) Format

func (*Driver) Format(s fmt.State, _ rune)

Format writes a fixed label without exposing transports.

func (*Driver) Send

func (d *Driver) Send(ctx context.Context, out email.Outbound) (email.Receipt, error)

Send tries transports in order, optionally rotating the first choice. Only transient failures permit failover.

Jump to

Keyboard shortcuts

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