Skip to content

Commit

Permalink
Add is_burner_domain function and update providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Aug 29, 2018
1 parent 75b72ed commit 1a7de49
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## 1.0.5 (2018-08-29)

* Enhancements
- Add `is_burner_domain/1` function to check the domain directly
- Update providers list
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/Betree/burnex.svg?branch=master)](https://travis-ci.org/Betree/burnex)
[![Coverage Status](https://coveralls.io/repos/github/Betree/burnex/badge.svg?branch=master)](https://coveralls.io/github/Betree/burnex?branch=master)

Compare an email address against 3700+ burner email domains (temporary email providers) based on
Compare an email address against 3900+ burner email domains (temporary email providers) based on
[this list](https://github.com/wesbos/burner-email-providers).

See [documentation](https://hexdocs.pm/burnex/Burnex.html).
Expand Down
23 changes: 20 additions & 3 deletions lib/burnex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,37 @@ defmodule Burnex do
@spec is_burner?(binary()) :: boolean()
def is_burner?(email) do
case Regex.run(~r/@([^@]+)$/, String.downcase(email)) do
[_ | [provider]] ->
Enum.any?(@providers, &Kernel.==(provider, &1))
[_ | [domain]] ->
is_burner_domain(domain)

_ ->
# Bad email format
false
end
end

@doc """
Check a domain
## Examples
iex> Burnex.is_burner_domain("yopmail.fr")
true
iex> Burnex.is_burner_domain("")
false
iex> Burnex.is_burner_domain("gmail.com")
false
"""
@spec is_burner_domain(binary()) :: boolean()
def is_burner_domain(domain) do
Enum.any?(@providers, &Kernel.==(domain, &1))
end

@doc """
Returns the list of all blacklisted domains providers
"""
@spec providers() :: nonempty_list(binary())
def providers() do
def providers do
@providers
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Burnex.Mixfile do
def project do
[
app: :burnex,
version: "1.0.4",
version: "1.0.5",
elixir: "~> 1.6.6",
description: "Elixir burner email (temporary address) detector",
start_permanent: Mix.env == :prod,
Expand Down
12 changes: 11 additions & 1 deletion priv/burner-email-providers/emails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,6 @@ icemovie.link
ichigo.me
icx.in
icx.ro
id.au
idigo.org
ieatspam.eu
ieatspam.info
Expand Down Expand Up @@ -2449,6 +2448,7 @@ nfast.net
nguyenusedcars.com
nh3.ro
nice-4u.com
nicemail.pro
nicewoodenbaskets.com
nicknassar.com
nickrizos.com
Expand Down Expand Up @@ -3899,3 +3899,13 @@ zxcv.com
zxcvbnm.com
zxcxc.com
zzi.us
pay-mon.com
zep-hyr.com
travala10.com
zippiex.com
poly-swarm.com
1shivom.com
fidelium10.com
hubii-network.com
hurify1.com
bit-degree.com
5 changes: 4 additions & 1 deletion test/burnex_test.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
defmodule BurnexTest do
@moduledoc """
Tests for `Burnex` module.
"""

use ExUnit.Case, async: true
use ExUnitProperties
doctest Burnex


test "example: filters jetable.org" do
assert Burnex.is_burner? "[email protected]"
end
Expand Down

0 comments on commit 1a7de49

Please sign in to comment.