package geoip

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
and charset =
  1. | GEOIP_CHARSET_ISO_8859_1
  2. | GEOIP_CHARSET_UTF8
and flags =
  1. | GEOIP_STANDARD
  2. | GEOIP_MEMORY_CACHE
  3. | GEOIP_CHECK_CACHE
  4. | GEOIP_INDEX_CACHE
  5. | GEOIP_MMAP_CACHE
and db_type =
  1. | GEOIP_COUNTRY_EDITION
  2. | GEOIP_REGION_EDITION_REV0
  3. | GEOIP_CITY_EDITION_REV0
  4. | GEOIP_ORG_EDITION
  5. | GEOIP_ISP_EDITION
  6. | GEOIP_CITY_EDITION_REV1
  7. | GEOIP_REGION_EDITION_REV1
  8. | GEOIP_PROXY_EDITION
  9. | GEOIP_ASNUM_EDITION
  10. | GEOIP_NETSPEED_EDITION
  11. | GEOIP_DOMAIN_EDITION
  12. | GEOIP_COUNTRY_EDITION_V6
  13. | GEOIP_LOCATIONA_EDITION
  14. | GEOIP_ACCURACYRADIUS_EDITION
  15. | GEOIP_CITYCONFIDENCE_EDITION
  16. | GEOIP_CITYCONFIDENCEDIST_EDITION
  17. | GEOIP_LARGE_COUNTRY_EDITION
  18. | GEOIP_LARGE_COUNTRY_EDITION_V6
and proxy_type =
  1. | GEOIP_ANON_PROXY
  2. | GEOIP_HTTP_X_FORWARDED_FOR_PROXY
  3. | GEOIP_HTTP_CLIENT_IP_PROXY
and netspeed =
  1. | GEOIP_UNKNOWN_SPEED
  2. | GEOIP_DIALUP_SPEED
  3. | GEOIP_CABLEDSL_SPEED
  4. | GEOIP_CORPORATE_SPEED

GeoIP database library

val setup_custom_directory : string -> unit
val is_db_avail : db_type -> bool
val init_exn : ?path:string -> ?db:db_type -> flags -> t

Open GeoIP database specified by path if given, otherwise open database by db_type if given, otherwise open default database.

  • raises Failure

    if database cannot be opened

val close : t -> unit
val country_code_by_addr : t -> string -> string option
val country_code_by_name : t -> string -> string option
val country_code3_by_addr : t -> string -> string option
val country_code3_by_name : t -> string -> string option
val country_name_by_addr : t -> string -> string option
val country_name_by_name : t -> string -> string option
val country_name_by_ipnum : t -> int32 -> string option
val country_code_by_ipnum : t -> int32 -> string option
val country_code3_by_ipnum : t -> int32 -> string option
val country_code_by_addr_v6 : t -> string -> string option
val country_code_by_name_v6 : t -> string -> string option
val country_code3_by_addr_v6 : t -> string -> string option
val country_code3_by_name_v6 : t -> string -> string option
val country_name_by_addr_v6 : t -> string -> string option
val country_name_by_name_v6 : t -> string -> string option
val id_by_addr : t -> string -> int
val id_by_name : t -> string -> int
val id_by_ipnum : t -> int -> int
val id_by_addr_v6 : t -> string -> int
val id_by_name_v6 : t -> string -> int
val num_countries : unit -> int
val database_info : t -> string
val database_edition : t -> int
val charset : t -> charset
val set_charset : t -> charset -> charset