{"modulePath":"github.com/foxcpp/maddy","version":"v0.9.8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package modules\n\n## Functions\n\n```go\nfunc NewDummy(_ *container.C, _, instName string) (module.Module, error)\n```\n\n```go\nfunc Register(name string, factory FuncNewModule)\n```\nRegister adds module factory function to global registry.\n\nname must be unique. Register will panic if module with specified name already exists in registry.\n\nYou probably want to call this function from func init() of module package.\n\n```go\nfunc RegisterDeprecated(name, newName string, factory FuncNewModule)\n```\nRegisterDeprecated adds module factory function to global registry.\n\nIt prints warning to the log about name being deprecated and suggests using a new name.\n\n```go\nfunc RegisterEndpoint(name string, factory FuncNewEndpoint)\n```\nRegisterEndpoint registers an endpoint module.\n\nSee FuncNewEndpoint for information about differences of endpoint modules from regular modules.\n\n## Types\n\n```go\ntype Dummy struct {\n\t// contains filtered or unexported fields\n}\n```\nDummy is a struct that implements PlainAuth and DeliveryTarget interfaces but does nothing. Useful for testing.\n\nIt 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).\n\n```go\nfunc (d *Dummy) AuthPlain(username, _ string) error\n```\n\n```go\nfunc (d *Dummy) Configure(_ []string, _ *config.Map) error\n```\n\n```go\nfunc (d *Dummy) InstanceName() string\n```\n\n```go\nfunc (d *Dummy) Lookup(_ context.Context, _ string) (string, bool, error)\n```\n\n```go\nfunc (d *Dummy) LookupMulti(_ context.Context, _ string) ([]string, error)\n```\n\n```go\nfunc (d *Dummy) Name() string\n```\n\n```go\nfunc (d *Dummy) StartDelivery(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) (module.Delivery, error)\n```\n\n```go\ntype FuncNewEndpoint func(c *container.C, modName string, addrs []string) (container.LifetimeModule, error)\n```\nFuncNewEndpoint is a function that creates new instance of endpoint module.\n\nCompared 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.\n\nAs a consequence of having no per-instance name, InstanceName of the module object always returns the same value as Name.\n\n```go\nfunc GetEndpoint(name string) FuncNewEndpoint\n```\nGetEndpoint returns an endpoint module from global registry.\n\nNil is returned if no module with specified name is registered.\n\n```go\ntype FuncNewModule func(c *container.C, modName, instName string) (module.Module, error)\n```\nFuncNewModule is function that creates new instance of module with specified name.\n\nModule.InstanceName() of the returned module object should return instName. If module is defined inline, instName will be empty.\n\nReturned Module may additionally implement LifetimeModule.\n\n```go\nfunc Get(name string) FuncNewModule\n```\nGet returns module from global registry.\n\nThis function does not return endpoint-type modules, use GetEndpoint for that. Nil is returned if no module with specified name is registered.\n\n","path":"github.com/foxcpp/maddy/framework/module/modules","name":"modules","synopsis":"","isRedistributable":true}
