{"modulePath":"github.com/foxcpp/maddy","version":"v0.9.8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package module\n\nPackage module contains modules registry and interfaces implemented by modules.\n\nInterfaces are placed here to prevent circular dependencies.\n\nEach interface required by maddy for operation is provided by some object called \"module\".  This includes authentication, storage backends, DKIM, email filters, etc.  Each module may serve multiple functions. I.e. it can be IMAP storage backend, SMTP downstream and authentication provider at the same moment.\n\nEach module gets its own unique name (sql for go-imap-sql, proxy for proxy module, local for local delivery perhaps, etc). Each module instance also can have its own unique name can be used to refer to it in configuration.\n\n## Constants\n\n```go\nconst (\n\tAuthDisabled     = \"off\"\n\tAuthMTASTS       = \"mtasts\"\n\tAuthDNSSEC       = \"dnssec\"\n\tAuthCommonDomain = \"common_domain\"\n)\n```\n\n```go\nconst UnknownBlobSize int64 = -1\n```\n\n## Variables\n\n```go\nvar ErrNoSuchBlob = errors.New(\"blob_store: no such object\")\n```\n\n```go\nvar ErrUnknownCredentials = errors.New(\"unknown credentials\")\n```\nErrUnknownCredentials should be returned by auth. provider if supplied credentials are valid for it but are not recognized (e.g. not found in used DB).\n\n## Functions\n\n```go\nfunc DisplayName(mod any) string\n```\nDisplayName returns a name that describes the provided module instance to the user.\n\n```go\nfunc GenerateMsgID() (string, error)\n```\nGenerateMsgID generates a string usable as MsgID field in module.MsgMeta.\n\n## Types\n\n```go\ntype Blob interface {\n\tSync() error\n\tio.Writer\n\tio.Closer\n}\n```\n\n```go\ntype BlobStore interface {\n\t// Create creates a new blob for writing.\n\t//\n\t// Sync will be called on the returned Blob object after -all- data has\n\t// been successfully written.\n\t//\n\t// Close without Sync can be assumed to happen due to an unrelated error\n\t// and stored data can be discarded.\n\t//\n\t// blobSize indicates the exact amount of bytes that will be written\n\t// If -1 is passed - it is unknown and implementation will not make\n\t// any assumptions about the blob size. Error can be returned by any\n\t// Blob method if more than than blobSize bytes get written.\n\t//\n\t// Passed context will cover the entire blob write operation.\n\tCreate(ctx context.Context, key string, blobSize int64) (Blob, error)\n\n\t// Open returns the reader for the object specified by\n\t// passed key.\n\t//\n\t// If no such object exists - ErrNoSuchBlob is returned.\n\tOpen(ctx context.Context, key string) (io.ReadCloser, error)\n\n\t// Delete removes a set of keys from store. Non-existent keys are ignored.\n\tDelete(ctx context.Context, keys []string) error\n}\n```\nBlobStore is the interface used by modules providing large binary object storage.\n\n```go\ntype Check interface {\n\t// CheckStateForMsg initializes the \"internal\" check state required for\n\t// processing of the new message.\n\t//\n\t// NOTE: Returned CheckState object must be hashable (usable as a map key).\n\t// This is used to deduplicate Check* calls, the easiest way to achieve\n\t// this is to have CheckState as a pointer to some struct, all pointers\n\t// are hashable.\n\tCheckStateForMsg(ctx context.Context, msgMeta *MsgMetadata) (CheckState, error)\n}\n```\nCheck is the module interface that is meant for read-only (with the exception of the message header modifications) (meta-)data checking.\n\nModules implementing this interface should be registered with \"check.\" prefix in name.\n\n```go\ntype CheckResult struct {\n\t// Reason is the error that is reported to the message source\n\t// if check decided that the message should be rejected.\n\tReason error\n\n\t// Reject is the flag that specifies that the message\n\t// should be rejected.\n\tReject bool\n\n\t// Quarantine is the flag that specifies that the message\n\t// is considered \"possibly malicious\" and should be\n\t// put into Junk mailbox.\n\t//\n\t// This value is copied into MsgMetadata by the msgpipeline.\n\tQuarantine bool\n\n\t// AuthResult is the information that is supposed to\n\t// be included in Authentication-Results header.\n\tAuthResult []authres.Result\n\n\t// Header is the header fields that should be\n\t// added to the header after all checks.\n\tHeader textproto.Header\n}\n```\n\n```go\ntype CheckState interface {\n\t// CheckConnection is executed once when client sends a new message.\n\tCheckConnection(ctx context.Context) CheckResult\n\n\t// CheckSender is executed once when client sends the message sender\n\t// information (e.g. on the MAIL FROM command).\n\tCheckSender(ctx context.Context, mailFrom string) CheckResult\n\n\t// CheckRcpt is executed for each recipient when its address is received\n\t// from the client (e.g. on the RCPT TO command).\n\tCheckRcpt(ctx context.Context, rcptTo string) CheckResult\n\n\t// CheckBody is executed once after the message body is received and\n\t// buffered in memory or on disk.\n\t//\n\t// Check code should use passed mutex when working with the message header.\n\t// Body can be read without locking it since it is read-only.\n\tCheckBody(ctx context.Context, header textproto.Header, body buffer.Buffer) CheckResult\n\n\t// Close is called after the message processing ends, even if any of the\n\t// Check* functions return an error.\n\tClose() error\n}\n```\n\n```go\ntype ConnState struct {\n\t// IANA name (ESMTP, ESMTPS, etc) of the protocol message was received\n\t// over. If the message was generated locally, this field is empty.\n\tProto string\n\n\t// Information about the SMTP connection, including HELO hostname and\n\t// source IP. Valid only if Proto refers the SMTP protocol or its variant\n\t// (e.g. LMTP).\n\tHostname   string\n\tLocalAddr  net.Addr\n\tRemoteAddr net.Addr\n\tTLS        tls.ConnectionState\n\n\t// The RDNSName field contains the result of Reverse DNS lookup on the\n\t// client IP.\n\t//\n\t// The underlying type is the string or untyped nil value. It is the\n\t// message source responsibility to populate this field.\n\t//\n\t// Valid values of this field consumers need to be aware of:\n\t// RDNSName = nil\n\t//   The reverse DNS lookup is not applicable for that message source.\n\t//   Typically the case for messages generated locally.\n\t// RDNSName != nil, but Get returns nil\n\t//   The reverse DNS lookup was attempted, but resulted in an error.\n\t//   Consumers should assume that the PTR record doesn't exist.\n\tRDNSName *future.Future\n\n\t// If the client successfully authenticated using a username/password pair.\n\t// This field contains the username.\n\tAuthUser string\n\n\t// If the client successfully authenticated using a username/password pair.\n\t// This field should be cleaned if the ConnState object is serialized\n\tAuthPassword string\n\n\tModData ModSpecificData\n}\n```\nConnState structure holds the state information of the protocol used to accept this message.\n\n```go\nfunc (state *ConnState) DeepCopy() *ConnState\n```\nDeepCopy creates an independent copy of the connection state. Referenced values such as net.Addr and RDNSName are not copied.\n\n```go\ntype Delivery interface {\n\t// AddRcpt adds the target address for the message.\n\t//\n\t// The domain part of the address is assumed to be U-labels with NFC normalization\n\t// and case-folding applied. The message source should ensure that by\n\t// calling address.CleanDomain if necessary.\n\t//\n\t// Implementation should assume that no case-folding or deduplication was\n\t// done by caller code. Its implementation responsibility to do so if it is\n\t// necessary. It is not recommended to reject duplicated recipients,\n\t// however. They should be silently ignored.\n\t//\n\t// Implementation should do as much checks as possible here and reject\n\t// recipients that can't be used.  Note: MsgMetadata object passed to StartDelivery\n\t// contains BodyLength field. If it is non-zero, it can be used to check\n\t// storage quota for the user before Body.\n\tAddRcpt(ctx context.Context, rcptTo string, opts smtp.RcptOptions) error\n\n\t// Body sets the body and header contents for the message.\n\t// If this method fails, message is assumed to be undeliverable\n\t// to all recipients.\n\t//\n\t// Implementation should avoid doing any persistent changes to the\n\t// underlying storage until Commit is called. If that is not possible,\n\t// Abort should (attempt to) rollback any such changes.\n\t//\n\t// If Body can't be implemented without per-recipient failures,\n\t// then delivery object should also implement PartialDelivery interface\n\t// for use by message sources that are able to make sense of per-recipient\n\t// errors.\n\t//\n\t// Here is the example of possible implementation for maildir-based\n\t// storage:\n\t// Calling Body creates a file in tmp/ directory.\n\t// Commit moves the created file to new/ directory.\n\t// Abort removes the created file.\n\tBody(ctx context.Context, header textproto.Header, body buffer.Buffer) error\n\n\t// Abort cancels message delivery.\n\t//\n\t// All changes made to the underlying storage should be aborted at this\n\t// point, if possible.\n\tAbort(ctx context.Context) error\n\n\t// Commit completes message delivery.\n\t//\n\t// It generally should never fail, since failures here jeopardize\n\t// atomicity of the delivery if multiple targets are used.\n\tCommit(ctx context.Context) error\n}\n```\n\n```go\ntype DeliveryMXAuthPolicy interface {\n\t// PrepareDomain is called before DNS MX lookup and may asynchronously\n\t// start additional lookups necessary for policy application in CheckMX\n\t// or CheckConn.\n\t//\n\t// If there any errors - they should be deferred to the CheckMX or\n\t// CheckConn call.\n\tPrepareDomain(ctx context.Context, domain string)\n\n\t// PrepareConn is called before connection and may asynchronously\n\t// start additional lookups necessary for policy application in\n\t// CheckConn.\n\t//\n\t// If there are any errors - they should be deferred to the CheckConn\n\t// call.\n\tPrepareConn(ctx context.Context, mx string)\n\n\t// CheckMX is called to check whether the policy permits to use a MX.\n\t//\n\t// mxLevel contains the MX security level estabilished by checks\n\t// executed before.\n\t//\n\t// domain is passed to the CheckMX to allow simpler implementation\n\t// of stateless policy objects.\n\t//\n\t// dnssec is true if the MX lookup was performed using DNSSEC-enabled\n\t// resolver and the zone is signed and its signature is valid.\n\tCheckMX(ctx context.Context, mxLevel MXLevel, domain, mx string, dnssec bool) (MXLevel, error)\n\n\t// CheckConn is called to check whether the policy permits to use this\n\t// connection.\n\t//\n\t// tlsLevel and mxLevel contain the TLS security level estabilished by\n\t// checks executed before.\n\t//\n\t// domain is passed to the CheckConn to allow simpler implementation\n\t// of stateless policy objects.\n\t//\n\t// If tlsState.HandshakeCompleted is false, TLS is not used. If\n\t// tlsState.VerifiedChains is nil, InsecureSkipVerify was used (no\n\t// ServerName or PKI check was done).\n\tCheckConn(ctx context.Context, mxLevel MXLevel, tlsLevel TLSLevel, domain, mx string, tlsState tls.ConnectionState) (TLSLevel, error)\n\n\t// Reset cleans the internal object state for use with another message.\n\t// newMsg may be nil if object is not needed anymore.\n\tReset(newMsg *MsgMetadata)\n}\n```\nDeliveryMXAuthPolicy is an interface of per-delivery object that estabilishes and verifies required and effective security for MX records and TLS connections.\n\n```go\ntype DeliveryTarget interface {\n\t// StartDelivery starts the delivery of a new message.\n\t//\n\t// The domain part of the MAIL FROM address is assumed to be U-labels with\n\t// NFC normalization and case-folding applied. The message source should\n\t// ensure that by calling address.CleanDomain if necessary.\n\tStartDelivery(ctx context.Context, msgMeta *MsgMetadata, mailFrom string) (Delivery, error)\n}\n```\nDeliveryTarget interface represents abstract storage for the message data (typically persistent) or other kind of component that can be used as a final destination for the message.\n\nModules implementing this interface should be registered with \"target.\" prefix in name.\n\n```go\ntype EarlyCheck interface {\n\tCheckConnection(ctx context.Context, state *ConnState) error\n}\n```\nEarlyCheck is an optional module interface that can be implemented by module implementing Check.\n\nIt is used as an optimization to reject obviously malicious connections before allocating resources for SMTP session.\n\nThe Status of this check is accept (no error) or reject (error) only, no advanced handling is available (such as 'quarantine' action and headers prepending).\n\nIf it s necessary to defer or affect further message processing without outright killing the session, ConnState.ModData can be used to store necessary information.\n\nIt may be called multiple times for the same connection if TLS is negotiated via STARTTLS. In this case, no state will be passed between before-TLS context to the TLS one.\n\n```go\ntype IMAPFilter interface {\n\t// IMAPFilter is called when message is about to be stored in IMAP-compatible\n\t// storage. It is called only for messages delivered over SMTP, hdr and body\n\t// contain the message exactly how it will be stored.\n\t//\n\t// Filter can change the target directory by returning non-empty folder value.\n\t// Additionally it can add additional IMAP flags to the message by returning\n\t// them.\n\t//\n\t// Errors returned by IMAPFilter will be just logged and will not cause delivery\n\t// to fail.\n\tIMAPFilter(accountName string, rcptTo string, meta *MsgMetadata, hdr textproto.Header, body buffer.Buffer) (folder string, flags []string, err error)\n}\n```\nIMAPFilter is interface used by modules that want to modify IMAP-specific message attributes on delivery.\n\nModules implementing this interface should be registered with namespace prefix \"imap.filter\".\n\n```go\ntype MXAuthPolicy interface {\n\tStartDelivery(*MsgMetadata) DeliveryMXAuthPolicy\n\n\t// Weight is an integer in range 0-1000 that represents relative\n\t// ordering of policy application.\n\tWeight() int\n}\n```\nMXAuthPolicy is an object that provides security check for outbound connections. It can do one of the following:\n\n\\- Check effective TLS level or MX level against some configured or discovered value. E.g. local policy.\n\n\\- Raise the security level if certain condition about used MX or connection is met. E.g. DANE MXAuthPolicy raises TLS level to Authenticated if a matching TLSA record is discovered.\n\n\\- Reject the connection if certain condition about used MX or connection is \\_not\\_ met. E.g. An enforced MTA-STS MXAuthPolicy rejects MX records not matching it.\n\nIt is not recommended to mix different types of behavior described above in the same implementation. Specifically, the first type is used mostly for local policies and is not really practical.\n\nModules implementing this interface should be registered with \"mx\\_auth.\" prefix in name.\n\n```go\ntype MXLevel int\n```\n\n```go\nconst (\n\tMXNone MXLevel = iota\n\tMX_MTASTS\n\tMX_DNSSEC\n)\n```\n\n```go\nfunc (l MXLevel) String() string\n```\n\n```go\ntype ManageableStorage interface {\n\tStorage\n\n\tListIMAPAccts() ([]string, error)\n\tCreateIMAPAcct(username string) error\n\tDeleteIMAPAcct(username string) error\n}\n```\nManageableStorage is an extended Storage interface that allows to list existing accounts, create and delete them.\n\n```go\ntype ModSpecificData struct {\n\t// contains filtered or unexported fields\n}\n```\nModSpecificData is a container that allows modules to attach additional context data to framework objects such as SMTP connections without conflicting with each other and ensuring each module gets its own namespace.\n\nIt must not be used to store stateful objects that may need a specific cleanup routine as ModSpecificData does not provide any lifetime management.\n\nStored data must be serializable to JSON for state persistence e.g. when message is stored in a on-disk queue.\n\n```go\nfunc (msd *ModSpecificData) Get(m Module, perInstance bool) any\n```\n\n```go\nfunc (msd *ModSpecificData) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (msd *ModSpecificData) Set(m Module, perInstance bool, value any)\n```\n\n```go\nfunc (msd *ModSpecificData) UnmarshalJSON(b []byte) error\n```\n\n```go\ntype Modifier interface {\n\t// ModStateForMsg initializes modifier \"internal\" state\n\t// required for processing of the message.\n\tModStateForMsg(ctx context.Context, msgMeta *MsgMetadata) (ModifierState, error)\n}\n```\nModifier is the module interface for modules that can mutate the processed message or its meta-data.\n\nCurrently, the message body can't be mutated for efficiency and correctness reasons: It would require \"rebuffering\" (see buffer.Buffer doc), can invalidate assertions made on the body contents before modification and will break DKIM signatures.\n\nOnly message header can be modified. Furthermore, it is highly discouraged for modifiers to remove or change existing fields to prevent issues outlined above.\n\nCalls on ModifierState are always strictly ordered. RewriteRcpt is newer called before RewriteSender and RewriteBody is never called before RewriteRcpts. This allows modificator code to save values passed to previous calls for use in later operations.\n\nModules implementing this interface should be registered with \"modify.\" prefix in name.\n\n```go\ntype ModifierState interface {\n\t// RewriteSender allows modifier to replace MAIL FROM value.\n\t// If no changes are required, this method returns its\n\t// argument, otherwise it returns a new value.\n\t//\n\t// Note that per-source/per-destination modifiers are executed\n\t// after routing decision is made so changed value will have no\n\t// effect on it.\n\t//\n\t// Also note that MsgMeta.OriginalFrom will still contain the original value\n\t// for purposes of tracing. It should not be modified by this method.\n\tRewriteSender(ctx context.Context, mailFrom string) (string, error)\n\n\t// RewriteRcpt replaces RCPT TO value.\n\t// If no changed are required, this method returns its argument as slice,\n\t// otherwise it returns a slice with 1 or more new values.\n\t//\n\t// MsgPipeline will take of populating MsgMeta.OriginalRcpts. RewriteRcpt\n\t// doesn't do it.\n\tRewriteRcpt(ctx context.Context, rcptTo string) ([]string, error)\n\n\t// RewriteBody modifies passed Header argument and may optionally\n\t// inspect the passed body buffer to make a decision on new header field values.\n\t//\n\t// There is no way to modify the body and RewriteBody should avoid\n\t// removing existing header fields and changing their values.\n\tRewriteBody(ctx context.Context, h *textproto.Header, body buffer.Buffer) error\n\n\t// Close is called after the message processing ends, even if any of the\n\t// Rewrite* functions return an error.\n\tClose() error\n}\n```\n\n```go\ntype Module interface {\n\tConfigure(inlineArgs []string, config *config.Map) error\n\n\t// Name method reports module name.\n\t//\n\t// It is used to reference module in the configuration and in logs.\n\tName() string\n\n\t// InstanceName method reports unique name of this module instance or empty\n\t// string if module instance is unnamed.\n\tInstanceName() string\n}\n```\nModule is the interface implemented by all maddy module instances.\n\n```go\ntype MsgMetadata struct {\n\t// Unique identifier for this message. Randomly generated by the\n\t// message source module.\n\tID string\n\n\t// Original message sender address as it was received by the message source.\n\t//\n\t// Note that this field is meant for use for tracing purposes.\n\t// All routing and other decisions should be made based on the sender address\n\t// passed separately (for example, mailFrom argument for CheckSender function)\n\t// Note that addresses may contain unescaped Unicode characters.\n\tOriginalFrom string\n\n\t// If set - no SrcHostname and SrcAddr will be added to Received\n\t// header. These fields are still written to the server log.\n\tDontTraceSender bool\n\n\t// Quarantine is a message flag that is should be set if message is\n\t// considered \"suspicious\" and should be put into \"Junk\" folder\n\t// in the storage.\n\t//\n\t// This field should not be modified by the checks that verify\n\t// the message. It is set only by the message pipeline.\n\tQuarantine bool\n\n\t// OriginalRcpts contains the mapping from the final recipient to the\n\t// recipient that was presented by the client.\n\t//\n\t// MsgPipeline will update that field when recipient modifiers\n\t// are executed.\n\t//\n\t// It should be used when reporting information back to client (via DSN,\n\t// for example) to prevent disclosing information about aliases\n\t// which is usually unwanted.\n\tOriginalRcpts map[string]string\n\n\t// SMTPOpts contains the SMTP MAIL FROM command arguments, if the message\n\t// was accepted over SMTP or SMTP-like protocol (such as LMTP).\n\t//\n\t// Note that the Size field should not be used as source of information about\n\t// the body size. Especially since it counts the header too whereas\n\t// Buffer.Len does not.\n\tSMTPOpts smtp.MailOptions\n\n\t// Conn contains the information about the underlying protocol connection\n\t// that was used to accept this message. The referenced instance may be shared\n\t// between multiple messages.\n\t//\n\t// It can be nil for locally generated messages.\n\tConn *ConnState\n\n\t// This is set by endpoint/smtp to indicate that body contains \"TLS-Required: No\"\n\t// header. It is only meaningful if server has seen the body at least once\n\t// (e.g. the message was passed via queue).\n\tTLSRequireOverride bool\n}\n```\nMsgMetadata structure contains all information about the origin of the message and all associated flags indicating how it should be handled by components.\n\nAll fields should be considered read-only except when otherwise is noted. Module instances should avoid keeping reference to the instance passed to it and copy the structure using DeepCopy method instead.\n\nCompatibility with older values should be considered when changing this structure since it is serialized to the disk by the queue module using JSON. Modules should correctly handle missing or invalid values.\n\n```go\nfunc (msgMeta *MsgMetadata) DeepCopy() *MsgMetadata\n```\nDeepCopy creates a copy of the MsgMetadata structure, also copying contents of the maps and slices.\n\nThere are a few exceptions, however: - SrcAddr is not copied and copy field references original value.\n\n```go\ntype MultiTable interface {\n\tLookupMulti(ctx context.Context, s string) ([]string, error)\n}\n```\nMultiTable is the interface that module can implement in addition to Table if it can provide multiple values as a lookup result.\n\n```go\ntype MutableTable interface {\n\tTable\n\tKeys() ([]string, error)\n\tRemoveKey(k string) error\n\tSetKey(k, v string) error\n}\n```\n\n```go\ntype PartialDelivery interface {\n\t// BodyNonAtomic is similar to Body method of the regular Delivery interface\n\t// with the except that it allows target to reject the body only for some\n\t// recipients by setting statuses using passed collector object.\n\t//\n\t// This interface is preferred by the LMTP endpoint and queue implementation\n\t// to ensure correct handling of partial failures.\n\tBodyNonAtomic(ctx context.Context, c StatusCollector, header textproto.Header, body buffer.Buffer)\n}\n```\nPartialDelivery is an optional interface that may be implemented by the object returned by DeliveryTarget.StartDelivery. See PartialDelivery.BodyNonAtomic documentation for details.\n\n```go\ntype PlainAuth interface {\n\tAuthPlain(username, password string) error\n}\n```\nPlainAuth is the interface implemented by modules providing authentication using username:password pairs.\n\nModules implementing this interface should be registered with \"auth.\" prefix in name.\n\n```go\ntype PlainUserDB interface {\n\tPlainAuth\n\tListUsers() ([]string, error)\n\tCreateUser(username, password string) error\n\tSetUserPassword(username, password string) error\n\tDeleteUser(username string) error\n}\n```\nPlainUserDB is a local credentials store that can be managed using maddy command utility.\n\n```go\ntype StatusCollector interface {\n\t// SetStatus sets the error associated with the recipient.\n\t//\n\t// rcptTo should match exactly the value that was passed to the\n\t// AddRcpt, i.e. if any translations was made by the target,\n\t// they should not affect the rcptTo argument here.\n\t//\n\t// It should not be called multiple times for the same\n\t// value of rcptTo. It also should not be called\n\t// after BodyNonAtomic returns.\n\t//\n\t// SetStatus is goroutine-safe. Implementations\n\t// provide necessary serialization.\n\tSetStatus(rcptTo string, err error)\n}\n```\nStatusCollector is an object that is passed by message source that is interested in intermediate status reports about partial delivery failures.\n\n```go\ntype Storage interface {\n\t// GetOrCreateIMAPAcct returns User associated with storage account specified by\n\t// the name.\n\t//\n\t// If it doesn't exists - it should be created.\n\tGetOrCreateIMAPAcct(username string) (imapbackend.User, error)\n\tGetIMAPAcct(username string) (imapbackend.User, error)\n\n\t// Extensions returns list of IMAP extensions supported by backend.\n\tIMAPExtensions() []string\n}\n```\nStorage interface is a slightly modified go-imap's Backend interface (authentication is removed).\n\nModules implementing this interface should be registered with prefix \"storage.\" in name.\n\n```go\ntype TLSLevel int\n```\n\n```go\nconst (\n\tTLSNone TLSLevel = iota\n\tTLSEncrypted\n\tTLSAuthenticated\n)\n```\n\n```go\nfunc (l TLSLevel) String() string\n```\n\n```go\ntype TLSLoader interface {\n\tConfigureTLS(c *tls.Config) error\n}\n```\nTLSLoader interface is module interface that can be used to supply TLS certificates to TLS-enabled endpoints.\n\nThe interface is intentionally kept simple, all configuration and parameters necessary are to be provided using conventional module configuration.\n\nIf loader returns multiple certificate chains - endpoint will serve them based on SNI matching.\n\nNote that loading function will be called for each connections - it is highly recommended to cache parsed form.\n\nModules implementing this interface should be registered with prefix \"tls.loader.\" in name.\n\n```go\ntype Table interface {\n\tLookup(ctx context.Context, s string) (string, bool, error)\n}\n```\nTable is the interface implemented by module that implementation string-to-string translation.\n\nModules implementing this interface should be registered with prefix \"table.\" in name.\n\n","path":"github.com/foxcpp/maddy/framework/module","name":"module","synopsis":"Package module contains modules registry and interfaces implemented by modules.","isRedistributable":true}
