Skip to content

Implement lookup op with lat/lon parsing and bogon handling#1

Merged
tamnd merged 1 commit into
mainfrom
implement-lookup
Jun 14, 2026
Merged

Implement lookup op with lat/lon parsing and bogon handling#1
tamnd merged 1 commit into
mainfrom
implement-lookup

Conversation

@tamnd

@tamnd tamnd commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Single lookup op with optional IP arg; omit the arg to look up your own IP via /json
  • IPInfo struct gains Lat and Lon fields split from the loc field returned by the API
  • Bogon IPs (private/reserved ranges) return {"ip":"...","bogon":true} with no geo data — the client now handles this gracefully with no error, emitting what the API provides
  • wire intermediary struct decouples raw JSON (with loc and bogon) from the clean output shape

Test plan

  • go build ./... passes
  • go test ./... passes (6 tests: UserAgent, LookupIP, Me, Bogon, Batch, Retry)
  • ./bin/ipinfo lookup 8.8.8.8 — Mountain View, lat/lon split correctly
  • ./bin/ipinfo lookup 1.1.1.1 — Brisbane, lat/lon split correctly
  • ./bin/ipinfo lookup (no arg) — own IP lookup via /json

- Single lookup op (optional IP arg; omit to look up your own IP)
- IPInfo struct gains Lat/Lon split from the loc field
- Bogon IPs (private ranges) return what the API provides, no error
- Wire struct intermediary decouples raw JSON from output shape
- Tests cover lat/lon parsing, bogon response, retry on 429
@tamnd tamnd merged commit 5b05723 into main Jun 14, 2026
3 of 6 checks passed
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.

1 participant