postgres

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAliasRepository

func NewAliasRepository(db *database.DB) repository.AliasRepository

NewAliasRepository creates a new PostgreSQL alias repository

func NewDomainRepository

func NewDomainRepository(db *database.DB) repository.DomainRepository

func NewGreylistRepository

func NewGreylistRepository(db *database.DB) repository.GreylistRepository

NewGreylistRepository creates a new PostgreSQL greylist repository

func NewIPBlacklistRepository

func NewIPBlacklistRepository(db *database.DB) repository.IPBlacklistRepository

NewIPBlacklistRepository creates a new PostgreSQL IP blacklist repository

func NewLoginAttemptRepository

func NewLoginAttemptRepository(db *database.DB) repository.LoginAttemptRepository

NewLoginAttemptRepository creates a new PostgreSQL login attempt repository

func NewMailboxRepository

func NewMailboxRepository(db *database.DB) repository.MailboxRepository

NewMailboxRepository creates a new PostgreSQL mailbox repository

func NewMessageRepository

func NewMessageRepository(db *database.DB) repository.MessageRepository

func NewQueueRepository

func NewQueueRepository(db *database.DB) repository.QueueRepository

NewQueueRepository creates a new PostgreSQL queue repository

func NewRateLimitRepository

func NewRateLimitRepository(db *database.DB) repository.RateLimitRepository

NewRateLimitRepository creates a new PostgreSQL rate limit repository

func NewUserRepository

func NewUserRepository(db *database.DB) repository.UserRepository

func NewWebhookRepository

func NewWebhookRepository(db *database.DB) repository.WebhookRepository

NewWebhookRepository creates a new PostgreSQL webhook repository

Types

type GreylistRepository

type GreylistRepository struct {
	// contains filtered or unexported fields
}

GreylistRepository implements repository.GreylistRepository

func (*GreylistRepository) Create

func (r *GreylistRepository) Create(ip, sender, recipient string) (*domain.GreylistTriplet, error)

Create creates a new greylist triplet

func (*GreylistRepository) DeleteOlderThan

func (r *GreylistRepository) DeleteOlderThan(age time.Duration) error

DeleteOlderThan deletes greylist entries older than the specified age

func (*GreylistRepository) Get

func (r *GreylistRepository) Get(ip, sender, recipient string) (*domain.GreylistTriplet, error)

Get retrieves a greylist triplet

func (*GreylistRepository) IncrementPass

func (r *GreylistRepository) IncrementPass(id int64) error

IncrementPass marks a greylist triplet as passed

type IPBlacklistRepository

type IPBlacklistRepository struct {
	// contains filtered or unexported fields
}

IPBlacklistRepository implements repository.IPBlacklistRepository

func (*IPBlacklistRepository) Add

func (r *IPBlacklistRepository) Add(ip, reason string, expiresAt *time.Time) error

Add adds an IP to the blacklist

func (*IPBlacklistRepository) IsBlacklisted

func (r *IPBlacklistRepository) IsBlacklisted(ip string) (bool, error)

IsBlacklisted checks if an IP is currently blacklisted

func (*IPBlacklistRepository) Remove

func (r *IPBlacklistRepository) Remove(ip string) error

Remove removes an IP from the blacklist

func (*IPBlacklistRepository) RemoveExpired

func (r *IPBlacklistRepository) RemoveExpired() error

RemoveExpired removes all expired blacklist entries

type LoginAttemptRepository

type LoginAttemptRepository struct {
	// contains filtered or unexported fields
}

LoginAttemptRepository implements repository.LoginAttemptRepository

func (*LoginAttemptRepository) Cleanup

func (r *LoginAttemptRepository) Cleanup(age time.Duration) error

Cleanup removes old login attempt records

func (*LoginAttemptRepository) GetRecentFailures

func (r *LoginAttemptRepository) GetRecentFailures(ip string, duration time.Duration) (int, error)

GetRecentFailures counts failed login attempts from an IP within the duration

func (*LoginAttemptRepository) GetRecentUserFailures

func (r *LoginAttemptRepository) GetRecentUserFailures(email string, duration time.Duration) (int, error)

GetRecentUserFailures counts failed login attempts for an email within the duration

func (*LoginAttemptRepository) Record

func (r *LoginAttemptRepository) Record(ip, email string, success bool) error

Record records a login attempt (success or failure)

type RateLimitRepository

type RateLimitRepository struct {
	// contains filtered or unexported fields
}

RateLimitRepository implements repository.RateLimitRepository

func (*RateLimitRepository) Cleanup

func (r *RateLimitRepository) Cleanup(windowDuration time.Duration) error

Cleanup removes old rate limit entries

func (*RateLimitRepository) CreateOrUpdate

func (r *RateLimitRepository) CreateOrUpdate(entry *domain.RateLimitEntry) error

CreateOrUpdate creates or updates a rate limit entry

func (*RateLimitRepository) Get

func (r *RateLimitRepository) Get(key string, limitType string) (*domain.RateLimitEntry, error)

Get retrieves a rate limit entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL