55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
# Crockery design
|
|
|
|
## Overview
|
|
|
|
We need:
|
|
|
|
* SMTP server
|
|
* Receive emails -> middlewares -> storage
|
|
* https://github.com/emersion/go-smtp ?
|
|
* IMAP server
|
|
* Receive logins
|
|
* HTTP server
|
|
* Serve autodiscovery bumpf
|
|
* ActiveSync protocol
|
|
* Storage
|
|
* Accounts
|
|
* Passwords!
|
|
* Emails
|
|
* TLS keys + certificates
|
|
* Search emails - some sort of inverted index necessary
|
|
* https://github.com/blevesearch/bleve ?
|
|
* Embedded database best. Ideally we have a single file to work with
|
|
* https://github.com/coreos/bbolt
|
|
* https://github.com/asdine/storm
|
|
|
|
## Database structure
|
|
|
|
I'm not sure what storm does under the hood. It seems clever. We have the
|
|
following, though:
|
|
|
|
* K-V store
|
|
* `config/domain`
|
|
* `domains/<domain>/config/cert`
|
|
* `domains/<domain>/config/key`
|
|
* ORM
|
|
* `Account`
|
|
* `Username`
|
|
* `Admin`
|
|
* `Wildcard`
|
|
* `PasswordHash`
|
|
* `Message`
|
|
* `ID`
|
|
* `Username`
|
|
* `Mailbox`
|
|
* `Header`
|
|
* `Body`
|
|
|
|
I don't seem to be able to get accounts for a list of usernames very easily, or
|
|
indexed-ly.
|
|
|
|
The message body is being stored inefficiently (json []byte, so base64-encoded)
|
|
|
|
Message username and mailbox are indexed, but is that good enough? Perhaps we
|
|
should have a bucket per mailbox or something?
|