ipinfo.tw icon indicating copy to clipboard operation
ipinfo.tw copied to clipboard

Add IP lookup feature

Open che0124 opened this issue 8 months ago • 6 comments

User description

  • Add new map.conf for IP-to-location mapping
  • Update nginx.conf to increase map_hash_bucket_size to handle larger maps
  • Update geoip2.conf to define variables for IP address lookup
  • Update ipinfo.conf to add location blocks for /lookup routing

PR Type

Enhancement, Documentation


Description

  • Introduce IP lookup feature via /lookup endpoint

    • Adds support for querying info for arbitrary IPs
    • Returns country, ASN, and user agent details
  • Update NGINX configuration for IP mapping and lookup variables

    • Adds map.conf for argument-based IP selection
    • Extends geoip2.conf for lookup variables
    • Adds /lookup location block in ipinfo.conf
    • Increases map_hash_bucket_size in nginx.conf
  • Update documentation to describe new lookup feature


Changes walkthrough 📝

Relevant files
Documentation
README.md
Document new IP lookup endpoint and usage                               

README.md

  • Documents new /lookup endpoint for IP queries
  • Adds usage example for IP lookup
  • +6/-0     
    Enhancement
    geoip2.conf
    Extend geoip2 config for lookup IP variables                         

    nginx/conf.d/geoip2.conf

  • Adds variables for IP lookup using $lookup_ip
  • Supports country and ASN info for arbitrary IPs
  • +9/-1     
    ipinfo.conf
    Add lookup variables and endpoint to ipinfo config             

    nginx/conf.d/ipinfo.conf

  • Defines variables for lookup country and ASN
  • Adds /lookup endpoint returning lookup info
  • +6/-0     
    map.conf
    Add map config for argument-based IP selection                     

    nginx/conf.d/map.conf

  • New file mapping query argument ip to $lookup_ip
  • Defaults to client IP if not provided
  • +4/-0     
    nginx.conf
    Increase map hash bucket size in nginx config                       

    nginx/nginx.conf

    • Increases map_hash_bucket_size to 128 for larger maps
    +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • New Features
      • Introduced a new /lookup endpoint that returns IP address, country, and ASN information for a specified IP or the client’s IP by default.
    • Documentation
      • Updated documentation to include details and example usage of the new /lookup endpoint.

    che0124 avatar May 01 '25 15:05 che0124