modules

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDummy

func NewDummy(_ *container.C, _, instName string) (module.Module, error)

func Register

func Register(name string, factory FuncNewModule)

Register adds module factory function to global registry.

name must be unique. Register will panic if module with specified name already exists in registry.

You probably want to call this function from func init() of module package.

func RegisterDeprecated

func RegisterDeprecated(name, newName string, factory FuncNewModule)

RegisterDeprecated adds module factory function to global registry.

It prints warning to the log about name being deprecated and suggests using a new name.

func RegisterEndpoint

func RegisterEndpoint(name string, factory FuncNewEndpoint)

RegisterEndpoint registers an endpoint module.

See FuncNewEndpoint for information about differences of endpoint modules from regular modules.

Types

type Dummy

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

Dummy is a struct that implements PlainAuth and DeliveryTarget interfaces but does nothing. Useful for testing.

It is always registered under the 'dummy' name and can be used in both tests and the actual server code (but the latter is kinda pointless).

func (*Dummy) AuthPlain

func (d *Dummy) AuthPlain(username, _ string) error

func (*Dummy) Configure

func (d *Dummy) Configure(_ []string, _ *config.Map) error

func (*Dummy) InstanceName

func (d *Dummy) InstanceName() string

func (*Dummy) Lookup

func (d *Dummy) Lookup(_ context.Context, _ string) (string, bool, error)

func (*Dummy) LookupMulti

func (d *Dummy) LookupMulti(_ context.Context, _ string) ([]string, error)

func (*Dummy) Name

func (d *Dummy) Name() string

func (*Dummy) StartDelivery

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

type FuncNewEndpoint

type FuncNewEndpoint func(c *container.C, modName string, addrs []string) (container.LifetimeModule, error)

FuncNewEndpoint is a function that creates new instance of endpoint module.

Compared to regular modules, endpoint module instances are: - Not registered in the global registry. - Can't be defined inline. - Don't have an unique name - All config arguments are always passed as an 'addrs' slice and not used as names.

As a consequence of having no per-instance name, InstanceName of the module object always returns the same value as Name.

func GetEndpoint

func GetEndpoint(name string) FuncNewEndpoint

GetEndpoint returns an endpoint module from global registry.

Nil is returned if no module with specified name is registered.

type FuncNewModule

type FuncNewModule func(c *container.C, modName, instName string) (module.Module, error)

FuncNewModule is function that creates new instance of module with specified name.

Module.InstanceName() of the returned module object should return instName. If module is defined inline, instName will be empty.

Returned Module may additionally implement LifetimeModule.

func Get

func Get(name string) FuncNewModule

Get returns module from global registry.

This function does not return endpoint-type modules, use GetEndpoint for that. Nil is returned if no module with specified name is registered.

Jump to

Keyboard shortcuts

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