The main client for interacting with the Ipregistry API. This class provides methods for looking up IP information, ASN details, parsing user agents, and more.

Constructors

Methods

  • Performs a batch lookup of Autonomous System Numbers (ASNs) and returns their information or errors. This method can leverage caching to avoid unnecessary API requests.

    Parameters

    • asns: number[]

      An array of ASNs (Autonomous System Numbers) to lookup.

    • ...options: IpregistryOption[]

      Optional. Additional options for the lookup operation.

    Returns Promise<ApiResponse<(AutonomousSystem | LookupError)[]>>

    A Promise resolving to an ApiResponse containing an array of AutonomousSystem or LookupError objects.

  • Performs a batch lookup of IP addresses and returns their information or errors. Similar to batchLookupAsns, this method also supports caching.

    Parameters

    • ips: string[]

      An array of IP addresses to lookup.

    • ...options: IpregistryOption[]

      Optional. Additional options for the lookup operation.

    Returns Promise<ApiResponse<(IpInfo | LookupError)[]>>

    A Promise resolving to an ApiResponse containing an array of IpInfo or LookupError objects.

  • Performs a lookup for the ASN information of the originating request's IP address. This is particularly useful for understanding the ASN of the caller itself. Note: Caching is incompatible with this method. Every call will incur a remote request to the Ipregistry API, which may consume credits or incur costs depending on your plan.

    Parameters

    • ...options: IpregistryOption[]

      Optional. Additional options for the lookup operation.

    Returns Promise<ApiResponse<RequesterAutonomousSystem>>

    A Promise resolving to an ApiResponse containing the RequesterAutonomousSystem information.

  • Performs a lookup for the IP information of the originating request's IP address. Useful for obtaining the caller's own IP information. Similar to originLookupAsn, this method does not support caching, and each invocation results in a remote API request to Ipregistry. This ensures that the most current information is retrieved but also means that each call will consume credits.

    Parameters

    • ...options: IpregistryOption[]

      Optional. Additional options for the lookup operation.

    Returns Promise<ApiResponse<RequesterIpInfo>>

    A Promise resolving to an ApiResponse containing the RequesterIpInfo.

  • Parses user agent strings and returns detailed information about them.

    Parameters

    • ...userAgents: string[]

      An array of user agent strings to parse.

    Returns Promise<ApiResponse<UserAgent[]>>

    A Promise resolving to an ApiResponse containing an array of UserAgent information.