Documentation
¶
Index ¶
- Constants
- type IPDatabase
- func (db *IPDatabase) Close() error
- func (db *IPDatabase) Delete(ip string) error
- func (db *IPDatabase) Get(ip string) (*domain.IPInfo, bool)
- func (db *IPDatabase) GetAllIPs() ([]*domain.IPInfo, error)
- func (db *IPDatabase) GetStats() (Stats, error)
- func (db *IPDatabase) MarkBlocked(ip string) error
- func (db *IPDatabase) Set(info *domain.IPInfo) error
- func (db *IPDatabase) Vacuum() error
- type Stats
Constants ¶
View Source
const ( // DefaultCleanupInterval to remove old entries DefaultCleanupInterval = 10 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPDatabase ¶
type IPDatabase struct {
// contains filtered or unexported fields
}
IPDatabase manages IP information persistence in SQLite
func NewIPDatabase ¶
func NewIPDatabase(dbPath string, ttl time.Duration) (*IPDatabase, error)
NewIPDatabase creates a new database instance
func (*IPDatabase) Close ¶
func (db *IPDatabase) Close() error
func (*IPDatabase) Delete ¶
func (db *IPDatabase) Delete(ip string) error
func (*IPDatabase) GetAllIPs ¶
func (db *IPDatabase) GetAllIPs() ([]*domain.IPInfo, error)
GetAllIPs returns all IP entries from the database
func (*IPDatabase) GetStats ¶
func (db *IPDatabase) GetStats() (Stats, error)
func (*IPDatabase) MarkBlocked ¶
func (db *IPDatabase) MarkBlocked(ip string) error
func (*IPDatabase) Vacuum ¶
func (db *IPDatabase) Vacuum() error
Click to show internal directories.
Click to hide internal directories.