百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

gman

> 编程语言
开源

一个 Ruby gem,用于检查给定电子邮件地址或网站的所有者是否为 THE MAN(又名验证政府域名)。

170 stars0 点赞6 次浏览
访问官网GitHub

工具介绍

一个 Ruby gem,用于检查给定电子邮件地址或网站的所有者是否为 THE MAN(又名验证政府域名)。

Gman

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. gov.uk, may be valid, for example, but gov.fr is not (it's gouv.fr, 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.

Installation

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 Gemfile before doing a bundle install:

gem 'gman'

Usage

In general

Verify email addresses

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

Verify domain

ruby
Gman.valid? "http://foo.bar.gov" #=> true
Gman.valid? "foo.bar.gov"        #=> true
Gman.valid? "foo.gov"            #=> true
Gman.valid? "foo.biz"            #=> false

Determine the type of domain

ruby
domain = Gman.new "whitehouse.gov"
domain.type     #=> :federal
domain.federal? #=> true
domain.state?   #=> false
domain.city?    #=> false
domain.county?  #=> false

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

ruby
domain = Gman.new "illinois.gov"
domain.state #=> "IL"
domain.city  #=> "springfield"

Get information about a .gov domain's owner

ruby
domain = Gman.new "whitehouse.gov"
domain.agency   #=> "Executive Office of the President"

Get the ISO Country Code information represented by a government domain

ruby
domain = Gman.new "whitehouse.gov" #=> #
domain.country.name                #=> "United States"
domain.country.alpha2              #=> "US"
domain.country.alpha3              #=> "USA"
domain.country.currency            #=> "USD"
domain.country.calling_code        #=> "+1"

Check if a country is on the US Sanctions list

ruby
Gman.new("foo.gov.kp").sanctioned? #=> true

Command line

Getting information about a given domain

$ gman whitehouse.gov
Domain  : whitehouse.gov
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  : illinois.gov
Valid government domain
Type    : state
Country : United States
State   : IL
City    : Springfield

Filter

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

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

Contributing

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

Credits

Heavily inspired by swot. Thanks @leereilly!

Issues· 9 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyemailgovernment

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言