src/nimip/main

Types

IPDefect = object of IPResponseError
Raised if the provided IP is defected or invalid.
IPRef = ref object
  address*: string
  locale*: Locale
  timeUntilReset*: int
  remainingRequests*: int
An object representing an IP address. This is the core object which can be used to interact with the application's base.
IPResponseError = object of HttpRequestError
Raised if the code can't communicate with the API due to unstable internet connection or other circumstances.
Locale {.pure.} = enum
  EN = "en", DE = "de", ES = "es", PT_BR = "pt-BR", FR = "fr", JA = "ja",
  ZH_CN = "zh-CN", RU = "ru"
An enum representing different types of locales. These can be used to modify the language in which the application receives data.
NotInitializedError = object of KeyError
Raised if the developer has not initialized the data inside the IPRef object with IPRef.refreshData().

Procs

proc asName(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                   forbids: [].}
The AS name (RIR) of the IP address. Empty for IP blocks not being announced in BGP tables.
proc city(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                 forbids: [].}
The city in which the IP address is located.
proc continent(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                      forbids: [].}
The continent in which the IP address is located.
proc continentCode(self: IPRef): string {....raises: [NotInitializedError],
    tags: [], forbids: [].}
The two-letter continent code (ISO 3166-1 alpha-2) of the IP address.
proc country(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                    forbids: [].}
The country from which the given IP address originates.
proc countryCode(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                        forbids: [].}
The two-letter country code (ISO 3166-1 alpha-2) of the IP address.
proc currency(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                     forbids: [].}
The currency used in the area of the IP address.
proc district(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                     forbids: [].}
The district in which the IP address is located.
proc hosting(self: IPRef): bool {....raises: [NotInitializedError], tags: [],
                                  forbids: [].}
Whether the IP address is a hosting provider.
proc isp(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                forbids: [].}
The Internet Service Provider (ISP) of the IP address.
proc latitude(self: IPRef): float {....raises: [NotInitializedError], tags: [],
                                    forbids: [].}
The coordinates (latitude) of the IP address.
proc longitude(self: IPRef): float {....raises: [NotInitializedError], tags: [],
                                     forbids: [].}
The coordinates (longitude) of the IP address.
proc mobile(self: IPRef): bool {....raises: [NotInitializedError], tags: [],
                                 forbids: [].}
Whether the IP address is a mobile connection.
proc offset(self: IPRef): int {....raises: [NotInitializedError], tags: [],
                                forbids: [].}
Timezone UTC DST offset in seconds.
proc org(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                forbids: [].}
The organization handling the IP address.
proc orgAs(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                  forbids: [].}
The AS number and organization related to the IP address. Empty for IP blocks not being announced in BGP tables.
proc proxy(self: IPRef): bool {....raises: [NotInitializedError], tags: [],
                                forbids: [].}
Whether the IP address is a proxy.
proc query(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                  forbids: [].}
The queried IP address.
proc refreshData(self: IPRef): Future[void] {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, ReadIOEffect, TimeEffect, WriteIOEffect], forbids: [].}
Query the API for the provided IP and load the returned data to the IPRef instance if successful.
proc region(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                   forbids: [].}
The region of the IP address.
proc regionName(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                       forbids: [].}
The name of the region of the IP address.
proc timezone(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                     forbids: [].}
The timezone of the area in which the IP address is located.
proc zip(self: IPRef): string {....raises: [NotInitializedError], tags: [],
                                forbids: [].}
The ZIP code of the IP address.