Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 655 Bytes

README.md

File metadata and controls

21 lines (17 loc) · 655 Bytes

hostbook

This is a Scala library that helps you do GeoIP lookups with the MaxMind GeoIP databases.

import io.imply.hostbook.GeoLookup
import java.io.File

object Example
{
  def main(args: Array[String]) {
    val file = new File("geodb")
    val geo = GeoLookup.fromFreeDownloadableDatabase(file)
    val result = geo.lookup("206.190.36.45")
    println(s"IP is from ${result.cityName.orNull}, ${result.regionName.orNull}, ${result.countryName.orNull}.")
  }
}