Documentation
¶
Overview ¶
Package demo is a dev-only, in-memory stand-in for a mail server and its DNS zone, so the Mail page can be exercised without a container, provider or domain.
Index ¶
- Constants
- func DKIMPublicKey() string
- func Enabled(devMode bool, getenv func(string) string) (on, ignored bool)
- func EnabledFromEnv(devMode bool) (on, ignored bool)
- type Engine
- func (e *Engine) AccountDetail(_ context.Context, name string) (mail.AccountDetail, error)
- func (e *Engine) Accounts(context.Context) ([]mail.Account, error)
- func (e *Engine) AddAccount(_ context.Context, a mail.AccountSpec) error
- func (e *Engine) AddAddress(_ context.Context, address, acct string) error
- func (e *Engine) AddAlias(_ context.Context, a mail.Alias) error
- func (e *Engine) AddDomain(_ context.Context, d mail.DomainSpec) error
- func (e *Engine) Aliases(_ context.Context, domain string) ([]mail.Alias, error)
- func (e *Engine) DKIMKeys(_ context.Context, _ string) ([]mail.DKIMKey, error)
- func (e *Engine) DNSRecords(_ context.Context, domain string) ([]mail.DNSRecord, error)
- func (e *Engine) Domains(context.Context) ([]mail.Domain, error)
- func (e *Engine) Health(context.Context) error
- func (e *Engine) HoldMessages(_ context.Context, ids []int64, hold bool) (int, error)
- func (e *Engine) HoldQueue(context.Context) error
- func (e *Engine) QueueList(_ context.Context, limit int) ([]mail.QueueEntry, error)
- func (e *Engine) QueueStats(context.Context) (mail.QueueStats, error)
- func (e *Engine) ReleaseQueue(context.Context) error
- func (e *Engine) RemoveAccount(_ context.Context, name string) error
- func (e *Engine) RemoveAlias(_ context.Context, address string) error
- func (e *Engine) RemoveDomain(_ context.Context, name string) error
- func (e *Engine) SetLoginDisabled(_ context.Context, acct, message string) error
- func (e *Engine) SetPassword(_ context.Context, acct, _ string) error
- func (e *Engine) SetQuota(_ context.Context, acct string, _ mail.Quota) error
- type Zone
- func (z *Zone) Capabilities() dnszones.Capabilities
- func (z *Zone) CreateZone(_ context.Context, name string) (dnszones.Zone, error)
- func (z *Zone) DeleteRecordSet(_ context.Context, zone dnszones.Zone, key dnszones.Key) error
- func (z *Zone) DeleteZone(_ context.Context, id string) error
- func (z *Zone) GetZone(_ context.Context, id string) (dnszones.Zone, error)
- func (z *Zone) ListRecordSets(_ context.Context, zone dnszones.Zone) ([]dnszones.RecordSet, error)
- func (z *Zone) ListZones(context.Context) ([]dnszones.Zone, error)
- func (z *Zone) LookupAddr(_ context.Context, addr string) ([]string, error)
- func (z *Zone) LookupCNAME(_ context.Context, name string) (string, error)
- func (z *Zone) LookupHost(_ context.Context, host string) ([]string, error)
- func (z *Zone) LookupMX(_ context.Context, name string) ([]*net.MX, error)
- func (z *Zone) LookupSRV(context.Context, string, string, string) (string, []*net.SRV, error)
- func (z *Zone) LookupTXT(_ context.Context, name string) ([]string, error)
- func (z *Zone) Name() string
- func (z *Zone) Reset()
- func (z *Zone) UpsertRecordSet(_ context.Context, zone dnszones.Zone, rs dnszones.RecordSet) error
- func (z *Zone) ZoneFor(domain string) dnszones.Zone
Constants ¶
const ( // DevModeEnv is the existing dev gate. DevModeEnv = "APP_DEV_MODE" // EnableEnv is the extra opt-in. EnableEnv = "APP_MAIL_DEMO" // DefaultDomain is used when the caller types no domain. DefaultDomain = "demo.example" // AppName is the fake mail app every demo request resolves to. AppName = "mail-demo" // ProviderName labels the fake zone provider in responses and audit rows. ProviderName = "demo" // FakeMarker is a placeholder that is not a credential for anything. FakeMarker = "demo-not-a-real-value" // DKIMSelector is the demo signing selector. DKIMSelector = "demo2026" // MailIPv4 is a documentation address (RFC 5737), never routable. MailIPv4 = "203.0.113.10" )
Variables ¶
This section is empty.
Functions ¶
func DKIMPublicKey ¶
func DKIMPublicKey() string
DKIMPublicKey is a throwaway public key made per process; its private half is discarded.
func Enabled ¶
Enabled reports whether demo mode is on. It needs both the dev gate and the opt-in; ignored is true when the opt-in is set without the dev gate.
func EnabledFromEnv ¶
EnabledFromEnv is Enabled over the process environment.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is an in-memory mail.Engine seeded with fixtures. It makes no network or filesystem call, so nothing it holds can reach a real server.
func NewEngine ¶
func NewEngine() *Engine
NewEngine returns an engine with two domains, five mailboxes, aliases and a queue.
func (*Engine) AccountDetail ¶
AccountDetail implements mail.Engine.
func (*Engine) AddAccount ¶
AddAccount implements mail.Engine.
func (*Engine) AddAddress ¶
AddAddress implements mail.Engine.
func (*Engine) DNSRecords ¶
DNSRecords implements mail.Engine.
func (*Engine) HoldMessages ¶
HoldMessages implements mail.Engine.
func (*Engine) QueueStats ¶
QueueStats implements mail.Engine.
func (*Engine) ReleaseQueue ¶
ReleaseQueue implements mail.Engine.
func (*Engine) RemoveAccount ¶
RemoveAccount implements mail.Engine.
func (*Engine) RemoveAlias ¶
RemoveAlias implements mail.Engine.
func (*Engine) RemoveDomain ¶
RemoveDomain implements mail.Engine.
func (*Engine) SetLoginDisabled ¶
SetLoginDisabled implements mail.Engine.
func (*Engine) SetPassword ¶
SetPassword implements mail.Engine.
type Zone ¶
type Zone struct {
// contains filtered or unexported fields
}
Zone is an in-memory DNS provider and resolver sharing one record store, so a record applied through it is what the check later resolves.
func (*Zone) Capabilities ¶
func (z *Zone) Capabilities() dnszones.Capabilities
Capabilities implements dnszones.Provider and the mailrecords resolver.
func (*Zone) CreateZone ¶
CreateZone implements dnszones.Provider and the mailrecords resolver.
func (*Zone) DeleteRecordSet ¶
DeleteRecordSet implements dnszones.Provider and the mailrecords resolver.
func (*Zone) DeleteZone ¶
DeleteZone implements dnszones.Provider and the mailrecords resolver.
func (*Zone) ListRecordSets ¶
ListRecordSets implements dnszones.Provider and the mailrecords resolver.
func (*Zone) LookupAddr ¶
LookupAddr plays the hosting provider's reverse DNS: any address the zone maps from a host name reverses to that name.
func (*Zone) LookupCNAME ¶
LookupCNAME implements dnszones.Provider and the mailrecords resolver.
func (*Zone) LookupHost ¶
LookupHost implements dnszones.Provider and the mailrecords resolver.
func (*Zone) Reset ¶
func (z *Zone) Reset()
Reset forgets every applied record, so the checklist fails again.
func (*Zone) UpsertRecordSet ¶
UpsertRecordSet implements dnszones.Provider and the mailrecords resolver.