Documentation
¶
Index ¶
- func NewDummy(_ *container.C, _, instName string) (module.Module, error)
- func Register(name string, factory FuncNewModule)
- func RegisterDeprecated(name, newName string, factory FuncNewModule)
- func RegisterEndpoint(name string, factory FuncNewEndpoint)
- type Dummy
- func (d *Dummy) AuthPlain(username, _ string) error
- func (d *Dummy) Configure(_ []string, _ *config.Map) error
- func (d *Dummy) InstanceName() string
- func (d *Dummy) Lookup(_ context.Context, _ string) (string, bool, error)
- func (d *Dummy) LookupMulti(_ context.Context, _ string) ([]string, error)
- func (d *Dummy) Name() string
- func (d *Dummy) StartDelivery(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) (module.Delivery, error)
- type FuncNewEndpoint
- type FuncNewModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) InstanceName ¶
func (*Dummy) LookupMulti ¶
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 ¶
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.