deacheck

package module
v0.0.0-...-0a506ae Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 9 Imported by: 0

README

DEA Check Go Report Card GoDoc

Using DEA (Disposable Email Address) is one of anti-spam techniques used to prevent unsolicited bulk email. On other side, as a service provider solicitous about security and privacy of our customers, we would waste resources on using those emails in our operations. That is why we need to include simple DEA check as one of sanitizing methods into registration process to our services.

Sources

Benchmarks

goos: darwin
goarch: amd64
pkg: github.com/redsift/deacheck
BenchmarkIndex_Update-4      	      50	  32096713 ns/op	11520228 B/op	  265259 allocs/op
BenchmarkIndex_HasDomain-4   	10000000	       192 ns/op	      18 B/op	       1 allocs/op
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index holds lists of domains from different sources

func NewIndex

func NewIndex(keys ...string) *Index

NewIndex creates *Index with declared sources. Each source is identified by key. Keys is a list of arbitrary strings

func (*Index) GetAndUpdate

func (i *Index) GetAndUpdate(source, url string) error

GetAndUpdate makes a GET HTTP request to given url string, then uses response body to update the source

func (*Index) GetSaveAndUpdate

func (i *Index) GetSaveAndUpdate(source, file, url string) error

GetSaveAndUpdate makes a GET HTTP request to given url string, then uses response body to update the source. Additionally, it writes response body to the file.

func (*Index) HasDomain

func (i *Index) HasDomain(source, domain string) bool

HasDomain checks if given domain is listed in the source

func (*Index) ReadAndUpdate

func (i *Index) ReadAndUpdate(source, file string) error

ReadAndUpdate opens given JSON file and updates the source from it.

func (*Index) UpdateFromJSON

func (i *Index) UpdateFromJSON(source string, r io.Reader) error

UpdateFromJSON updates given source from the io.Reader r. It assumes incoming JSON is an array of strings. The update happen atomically.

Jump to

Keyboard shortcuts

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