Documentation
¶
Overview ¶
Package imapsql implements SQL-based storage module using go-imap-sql library (github.com/foxcpp/go-imap-sql).
Interfaces implemented: - module.StorageBackend - module.PlainAuth - module.DeliveryTarget
Index ¶
- func New(_, instName string, _, inlineArgs []string) (module.Module, error)
- type ExtBlob
- type ExtBlobStore
- type Storage
- func (store *Storage) BlockUser(username, reason string) error
- func (store *Storage) Close() error
- func (store *Storage) CreateIMAPAcct(accountName string) error
- func (store *Storage) CreateMessageLimit() *uint32
- func (store *Storage) DeleteAccount(username, reason string) error
- func (store *Storage) DeleteIMAPAcct(accountName string) error
- func (store *Storage) EnableUpdatePipe(mode updatepipe.BackendMode) error
- func (store *Storage) GetAccountDate(username string) (created int64, err error)
- func (store *Storage) GetAllAccountInfo() (map[string]module.AccountInfo, error)
- func (store *Storage) GetAllUsedStorage() (map[string]int64, error)
- func (store *Storage) GetDefaultQuota() int64
- func (store *Storage) GetGORMDB() *gorm.DB
- func (store *Storage) GetIMAPAcct(accountName string) (backend.User, error)
- func (store *Storage) GetOrCreateIMAPAcct(username string) (backend.User, error)
- func (store *Storage) GetQuota(username string) (used, max int64, isDefault bool, err error)
- func (store *Storage) GetStat() (totalStorage int64, accountsCount int, err error)
- func (store *Storage) I18NLevel() int
- func (store *Storage) IMAPExtensions() []string
- func (store *Storage) Init(cfg *config.Map) error
- func (store *Storage) InstanceName() string
- func (store *Storage) IsBlocked(username string) (bool, error)
- func (store *Storage) IsJitRegistrationEnabled() (bool, error)
- func (store *Storage) IsRegistrationOpen() (bool, error)
- func (store *Storage) ListBlockedUsers() ([]module.BlockedUserEntry, error)
- func (store *Storage) ListIMAPAccts() ([]string, error)
- func (store *Storage) Login(_ *imap.ConnInfo, usenrame, password string) (backend.User, error)
- func (store *Storage) Lookup(ctx context.Context, key string) (string, bool, error)
- func (store *Storage) MigrateFirstLoginFromCreatedAt() error
- func (store *Storage) Name() string
- func (store *Storage) PruneMessages(retention time.Duration) error
- func (store *Storage) PruneUnreadIMAPMsgs(retention time.Duration) error
- func (store *Storage) PruneUnusedAccounts(retention time.Duration) error
- func (store *Storage) PurgeAllIMAPMsgs() error
- func (store *Storage) PurgeIMAPMsgs(username string) error
- func (store *Storage) PurgeReadIMAPMsgs() error
- func (store *Storage) ResetQuota(username string) error
- func (store *Storage) SetDefaultQuota(max int64) error
- func (store *Storage) SetQuota(username string, max int64) error
- func (store *Storage) Start(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) (module.Delivery, error)
- func (store *Storage) SupportedThreadAlgorithms() []sortthread.ThreadAlgorithm
- func (store *Storage) UnblockUser(username string) error
- func (store *Storage) UpdateFirstLogin(username string) error
- type WriteExtBlob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExtBlob ¶
type ExtBlob struct {
io.ReadCloser
}
type ExtBlobStore ¶
func (ExtBlobStore) Create ¶
func (e ExtBlobStore) Create(key string, objSize int64) (imapsql.ExtStoreObj, error)
func (ExtBlobStore) Delete ¶
func (e ExtBlobStore) Delete(keys []string) error
func (ExtBlobStore) Open ¶
func (e ExtBlobStore) Open(key string) (imapsql.ExtStoreObj, error)
type Storage ¶
type Storage struct {
Back *imapsql.Backend
GORMDB *gorm.DB
Log log.Logger
// QuotaCache is the in-memory quota cache for fast per-user lookups.
// Exported so the IMAP endpoint, admin API, and CLI can access it.
QuotaCache *quota.Cache
// contains filtered or unexported fields
}
func (*Storage) BlockUser ¶ added in v0.15.0
BlockUser adds a username to the blocklist, preventing re-registration.
func (*Storage) CreateIMAPAcct ¶
func (*Storage) CreateMessageLimit ¶
func (*Storage) DeleteAccount ¶ added in v0.15.0
DeleteAccount performs a full account removal: 1. Delete IMAP storage (account + mailboxes + messages) 2. Delete quota record from DB 3. Block the username from re-registration
func (*Storage) DeleteIMAPAcct ¶
func (*Storage) EnableUpdatePipe ¶
func (store *Storage) EnableUpdatePipe(mode updatepipe.BackendMode) error
func (*Storage) GetAccountDate ¶
func (*Storage) GetAllAccountInfo ¶ added in v0.15.0
func (store *Storage) GetAllAccountInfo() (map[string]module.AccountInfo, error)
func (*Storage) GetAllUsedStorage ¶ added in v0.15.0
GetAllUsedStorage returns per-user storage usage in a single query.
func (*Storage) GetDefaultQuota ¶
func (*Storage) GetGORMDB ¶ added in v0.14.1
GetGORMDB implements module.GORMProvider. It exposes the shared GORM database connection so other modules (e.g. target.remote for DNS cache) can add their tables to the same database.
func (*Storage) GetIMAPAcct ¶
func (*Storage) GetOrCreateIMAPAcct ¶
func (*Storage) IMAPExtensions ¶
func (*Storage) InstanceName ¶
func (*Storage) IsJitRegistrationEnabled ¶ added in v0.10.0
func (*Storage) IsRegistrationOpen ¶
func (*Storage) ListBlockedUsers ¶ added in v0.15.0
func (store *Storage) ListBlockedUsers() ([]module.BlockedUserEntry, error)
ListBlockedUsers returns all blocked usernames.
func (*Storage) ListIMAPAccts ¶
func (*Storage) MigrateFirstLoginFromCreatedAt ¶ added in v0.12.0
func (*Storage) PruneUnreadIMAPMsgs ¶ added in v0.12.4
func (*Storage) PruneUnusedAccounts ¶ added in v0.12.0
func (*Storage) PurgeAllIMAPMsgs ¶ added in v0.12.4
func (*Storage) PurgeIMAPMsgs ¶
func (*Storage) PurgeReadIMAPMsgs ¶ added in v0.12.4
func (*Storage) ResetQuota ¶
func (*Storage) SetDefaultQuota ¶
func (*Storage) SupportedThreadAlgorithms ¶
func (store *Storage) SupportedThreadAlgorithms() []sortthread.ThreadAlgorithm
func (*Storage) UnblockUser ¶ added in v0.15.0
UnblockUser removes a username from the blocklist.