Skip to content

gurusalih/deckv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deckv - Disposable Email Checker as a Key-Value Store for Golang

Go Reference License: MIT

Deckv is a simple and efficient blocklist implementation for Go applications with support for multiple storage backends.

Features

  • Simple and easy-to-use API
  • Multiple storage backend support
    • In-memory storage (default)
    • Redis storage
  • Configurable through simple text files
  • Context support for all operations
  • Thread-safe operations

Installation

go get github.com/9ssi7/deckv

Usage

See the examples directory for more detailed usage examples.

Quick Start

Blocklist Configuration File

You can create a blocklist configuration file with the following content:

0-mail.com
1-mail.com

or real and full domain names, use this file disposable-email-domains config file as a reference.

Using In-Memory Storage

Create a blocklist.conf file with the following content:

0-mail.com
1-mail.com
client := deckv.New(deckv.WithConfFilePath("./blocklist.conf"))
err := client.Load(context.Background())
if err != nil {
    panic(err)
}
isBlocked, err := client.Check(context.Background(), "0-mail.com")
if err != nil {
    panic(err)
}
fmt.Println(isBlocked)

Using Redis Storage

Create a blocklist.conf file with the following content:

0-mail.com
1-mail.com

You can use Redis storage by setting the WithStorage option.

storage := deckvredis.New(deckvredis.Config{
    Host:     "localhost",
    Port:     "6379",
    Password: "",
    DB:       0,
})
client := deckv.New(deckv.WithConfFilePath("./blocklist.conf"), deckv.WithStorage(storage))
err := client.Load(context.Background())
if err != nil {
    panic(err)
}
isBlocked, err := client.Check(context.Background(), deckv.FromEmail("test@0-mail.com"))
if err != nil {
    panic(err)
}
fmt.Println(isBlocked)

Configuration File Format

The blocklist configuration file is a simple text file with one entry per line:

0-mail.com
1-mail.com

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

simple and efficient disposable and temporary email address domain checker implementation for Go applications

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages