Need help with gman?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

142 Stars 92 Forks MIT License 659 Commits 7 Opened issues


A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains).

Services available


Need anything else?

Contributors list


Build Status Gem Version PRs Welcome

A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains). It will also provide you with metadata about the domain, such as the country, state, city, or agency, where applicable. It does this by leveraging the power of Naughty or Nice, the Public Suffix List, and the associated Ruby Gem.

You could theoretically use regex, but either you'll get a bunch of false positives, or your regex will be insanely complicated.
, may be valid, for example, but
is not (it's
, for what it's worth). The solution? Use Public Suffix to verify that it's a valid public domain, then maintain a crowd-sourced sub-list of known global government and military domains. It should cover all US and international, government and military domains for both email and website verification.

See a domains that's missing or one that shouldn't be there? We'd love you to contribute.


Gman is a Ruby gem, so you'll need a little Ruby-fu to get it working. Simply

gem install gman

Or add this to your

before doing a
bundle install

gem 'gman'


In general

Verify email addresses

Gman.valid? "[email protected]" #=> true
Gman.valid? "[email protected]" #=> false

Verify domain

Gman.valid? "" #=> true
Gman.valid? ""        #=> true
Gman.valid? ""            #=> true
Gman.valid? ""            #=> false

Determine the type of domain

domain = ""
domain.type     #=> :federal
domain.federal? #=> true
domain.state?   #=> false    #=> false
domain.county?  #=> false

Get information about the domain's geographic location (.gov and .us only)

domain = ""
domain.state #=> "IL"  #=> "springfield"

Get information about a .gov domain's owner

domain = ""   #=> "Executive Office of the President"

Get the ISO Country Code information represented by a government domain

domain = "" #=> #                #=> "United States"              #=> "US"              #=> "USA"            #=> "USD"        #=> "+1"

Check if a country is on the US Sanctions list"").sanctioned? #=> true

Command line

Getting information about a given domain

$ gman
Domain  :
Valid government domain
Type    : federal
Country : United States
State   : DC
City    : Washington
Agency  : Executive Office of the President

The command line tool will accept any domain-like string (email, url, etc.)

$ gman [email protected]
Domain  :
Valid government domain
Type    : state
Country : United States
State   : IL
City    : Springfield


Filters newline-separated email addresses from stdin. Example usage:

$ gman_filter < path/to/list/of/addresses.txt


Contributions welcome! Please see the contribution guidelines for code contributions or for details on how to add, update, or delete government domains.


Heavily inspired by swot. Thanks @leereilly!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.