https://github.com/9ssi7/deckv
simple and efficient disposable and temporary email address domain checker implementation for Go applications
https://github.com/9ssi7/deckv
allowlist blocklist disposable domain email filter golang
Last synced: 9 months ago
JSON representation
simple and efficient disposable and temporary email address domain checker implementation for Go applications
- Host: GitHub
- URL: https://github.com/9ssi7/deckv
- Owner: 9ssi7
- License: mit
- Created: 2025-01-14T15:30:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-20T21:47:57.000Z (over 1 year ago)
- Last Synced: 2025-09-06T09:45:05.638Z (10 months ago)
- Topics: allowlist, blocklist, disposable, domain, email, filter, golang
- Language: Go
- Homepage: https://pkg.go.dev/github.com/9ssi7/deckv
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deckv - Disposable Email Checker as a Key-Value Store for Golang
[](https://pkg.go.dev/github.com/9ssi7/deckv)
[](https://opensource.org/licenses/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
```bash
go get github.com/9ssi7/deckv
```
## Usage
See the [examples](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](https://github.com/disposable-email-domains/disposable-email-domains/blob/main/disposable_email_blocklist.conf) as a reference.
### Using In-Memory Storage
Create a `blocklist.conf` file with the following content:
```
0-mail.com
1-mail.com
```
```go
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.
```go
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](LICENSE) file for details.