Skip to content

feat: use geoip string as IP directly, skip publicIP lookup - #324

Merged
barjin merged 1 commit into
apify:masterfrom
softko:geoip-ip-support
Aug 16, 2026
Merged

feat: use geoip string as IP directly, skip publicIP lookup#324
barjin merged 1 commit into
apify:masterfrom
softko:geoip-ip-support

Conversation

@softko

@softko softko commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The geoip option already accepts string | boolean in the TypeScript type definition (matching the Python API), but the implementation always called publicIP() to resolve the address — ignoring any string value passed by the caller.

Changes:

  • If geoip is a valid IP string, it is used directly for geolocation lookup — no outbound request is made to resolve the public IP
  • If geoip is true, behavior is unchanged: the public IP is resolved automatically (via the proxy if one is set)
  • Invalid IP strings are caught by the existing validateIP call inside getGeolocation

This brings the JS implementation in line with the Python version's documented behavior:
Pass the target IP address to use, or true to find the IP address automatically.

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thank you for your contribution @softko !

@barjin
barjin merged commit f5493e4 into apify:master Aug 16, 2026
4 checks passed
@softko
softko deleted the geoip-ip-support branch August 18, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants