What

IANA Ruby module version 0.0.4

I like to look stuff up, like TCP/IP port numbers, protocols, top-level domains, et al. I get my data from the Internet Assigned Numbers Authority (IANA) and like to make it available to my programs. Since I am open sourcing this code you can add this functionality to your own programs as well.

How

require 'rubygems' require 'iana'

The IANA Ruby module loads the data into conveniently searchable data structures. The flat files the IANA Ruby module consume as data are hosted at iana.org. You will need to fetch them so you can process the content locally. I grab these files with with curl (but you can use wget or whatever if you don't use curl):

curl -O www.iana.org/assignments/port-numbers curl -O www.iana.org/assignments/protocol-numbers curl -O data.iana.org/TLD/tlds-alpha-by-domain.txt

Examples

When you run the example programs, do it like so:

ruby examples/ports.rb port-numbers

Use these example programs to see how you might use and otherwise integrate IANA data functionality into your own programs.

Install

I added a Rakefile and a gem spec. To build the gem, just type:

rake gem

To install the gem, just type:

sudo gem install pkg/iana-0.0.4.gem

Notes

I haven't tested this code with YARV, so YMMV.

Contribute

The source is availble at github: git://github.com/yesmar/iana.git. Feel free to clone it and implement your own awesome ideas. You can also send your patches by email to yesmar[at]speakeasynet.