msgpipeline

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModule

func NewModule(modName, instName string, aliases, inlineArgs []string) (module.Module, error)

Types

type CheckGroup

type CheckGroup struct {
	L []module.Check
	// contains filtered or unexported fields
}

CheckGroup is a module container for a group of Check implementations.

It allows to share a set of filter configurations between using named configuration blocks (module instances) system.

It is registered globally under the name 'checks'. The object does not implement any standard module interfaces besides module.Module and is specific to the message pipeline.

func (*CheckGroup) Init

func (cg *CheckGroup) Init(cfg *config.Map) error

func (CheckGroup) InstanceName

func (cg CheckGroup) InstanceName() string

func (CheckGroup) Name

func (CheckGroup) Name() string

type Module

type Module struct {
	*MsgPipeline
	// contains filtered or unexported fields
}

func (*Module) Init

func (m *Module) Init(cfg *config.Map) error

func (*Module) InstanceName

func (m *Module) InstanceName() string

func (*Module) Name

func (m *Module) Name() string

type MsgPipeline

type MsgPipeline struct {
	Hostname string
	Resolver dns.Resolver

	// Used to indicate the pipeline is handling messages received from the
	// external source and not from any other module. That is, this MsgPipeline
	// is an instance embedded in endpoint/smtp implementation, for example.
	//
	// This is a hack since only MsgPipeline can execute some operations at the
	// right time but it is not a good idea to execute them multiple multiple
	// times for a single message that might be actually handled my multiple
	// pipelines via 'msgpipeline' module or 'reroute' directive.
	//
	// At the moment, the only such operation is the addition of the Received
	// header field. See where it happens for explanation on why it is done
	// exactly in this place.
	FirstPipeline bool

	Log log.Logger
	// contains filtered or unexported fields
}

MsgPipeline is a object that is responsible for selecting delivery targets for the message and running necessary checks and modifiers.

It implements module.DeliveryTarget.

It is not a "module object" and is intended to be used as part of message source (Submission, SMTP, JMAP modules) implementation.

func Mock

func Mock(tgt module.DeliveryTarget, globalChecks []module.Check) *MsgPipeline

Mock returns a MsgPipeline that merely delivers messages to a specified target and runs a set of checks.

It is meant for use in tests for modules that embed a pipeline object.

func New

func New(globals map[string]interface{}, cfg []config.Node) (*MsgPipeline, error)

func (*MsgPipeline) RunEarlyChecks

func (d *MsgPipeline) RunEarlyChecks(ctx context.Context, state *smtp.ConnectionState) error

func (*MsgPipeline) Start

func (d *MsgPipeline) Start(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) (module.Delivery, error)

Start starts new message delivery, runs connection and sender checks, sender modifiers and selects source block from config to use for handling.

Returned module.Delivery implements PartialDelivery. If underlying target doesn't support it, msgpipeline will copy the returned error for all recipients handled by target.

Jump to

Keyboard shortcuts

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