Documentation
¶
Overview ¶
Package engine assembles lfr: it opens the data directory, wires the services together, runs the SMTP and HTTP servers, the delivery queue and the scheduler, and answers the CLI over the control socket.
Index ¶
- Constants
- func DetectIPv4() string
- func SocketPath(data string) string
- func SystemdUnit(binary, data, user string) string
- type Engine
- func (e *Engine) Backup(ctx context.Context, send func(any) error) error
- func (e *Engine) BaseURL(l *lists.List) string
- func (e *Engine) Close() error
- func (e *Engine) Doctor(ctx context.Context) []api.Check
- func (e *Engine) Hostname(ctx context.Context) string
- func (e *Engine) Instance(ctx context.Context) domains.Instance
- func (e *Engine) ListURL(l *lists.List) string
- func (e *Engine) Run(ctx context.Context) error
- func (e *Engine) Signup(ctx context.Context, l *lists.List, email string, s lists.Signup) error
- func (e *Engine) Status(ctx context.Context) (api.Status, error)
- type Options
- type SetupOptions
- type SetupResult
Constants ¶
const ( DBFile = "lfr.db" Socket = "lfr.sock" BlobDir = "msg" SiteDir = "sites" CertDir = "certs" SocketEnv = "LFR_SOCKET" )
Paths inside the data directory.
const BackupDone = "BACKUP-COMPLETE"
BackupDone marks a complete backup.
Variables ¶
This section is empty.
Functions ¶
func DetectIPv4 ¶
func DetectIPv4() string
DetectIPv4 finds the first public IPv4 address on a local interface, as cloud servers like DigitalOcean droplets have.
func SystemdUnit ¶
SystemdUnit is the service definition `lfr setup --systemd` installs.
Types ¶
type Engine ¶
type Engine struct {
Opts Options
DB *store.DB
Blobs *blob.Store
Config config.Config
Tokens *token.Signer
Events *events.Bus
Domains *domains.Service
Mailbox *mailbox.Service
Lists *lists.Service
Issues *issues.Service
Renderer *issues.Renderer
Queue *outbound.Queue
Spam *spam.Classifier
Sites *web.Sites
Web *web.Server
Inbound *inbound.Server
Certs *certs.Manager
Ctl *ctl.Server
DNS dnsx.Resolver
Log *slog.Logger
// contains filtered or unexported fields
}
Engine is a running lfr.
func (*Engine) Backup ¶
Backup streams a snapshot and immutable blobs, bounded by socket backpressure.
func (*Engine) BaseURL ¶
BaseURL is where a list's token links (confirm, unsubscribe, tracking) live.
type Options ¶
type Options struct {
Data string
SMTPAddr string // ":25"
HTTPAddr string // ":80"
HTTPSAddr string // ":443"
Version string
Log *slog.Logger
// For tests and special setups.
DNS dnsx.Resolver
Transport outbound.Transport
Now func() time.Time
SocketMode os.FileMode
}
Options are process-level settings of `lfr serve`.
type SetupOptions ¶
type SetupOptions struct {
Data string
Hostname string
IPv4 string // detected when empty
IPv6 string
ACMEEmail string
Now func() int64
}
SetupOptions are the first settings of a data directory.
type SetupResult ¶
type SetupResult struct {
Data string `json:"data"`
Hostname string `json:"hostname"`
IPv4 string `json:"ipv4,omitempty"`
IPv6 string `json:"ipv6,omitempty"`
Existing bool `json:"existing"`
}
SetupResult reports what Setup did.
func Setup ¶
func Setup(ctx context.Context, o SetupOptions) (SetupResult, error)
Setup creates or updates a data directory. Running it again keeps all data and only changes the settings given.