Skip to content

Releases: netloc8/netloc8-go

v1.2.2 — geo:read → location:read scope migration

Choose a tag to compare

@tomvoss tomvoss released this 24 Jun 14:06

Changed

  • Test fixtures in account_test.go and example_test.go updated to use location:read scope (renamed from geo:read as part of the API-wide scope migration).

v1.2.1

Choose a tag to compare

@tomvoss tomvoss released this 13 Jun 22:53

Fixed

  • IsPublicIP — IPv6 link-local detection now correctly covers the full fe80::/10 range (fe80:: through febf::). Previously only addresses starting with fe80 were rejected; addresses like fe90::1, fea0::1, and febf::1 were incorrectly treated as public. Now uses byte-level CIDR inspection instead of string prefix matching.

Added

  • Test cases for IPv6 link-local boundary: fe90::1, fea0::1, febf::1 (non-public) and fec0::1 (public, just outside /10).

go get github.com/netloc8/netloc8-go@v1.2.1

v1.2.0 — Geo Accessors, Coordinate Presence Detection

Choose a tag to compare

@tomvoss tomvoss released this 13 Jun 19:15
c674ee0

Expands the nil-safe accessor surface with RegionCode(), Lat(), Lng(), and a new HasCoordinates() predicate for distinguishing absent coordinates from a real 0,0 location.

Highlights

🧭 RegionCode() — nil-safe accessor for ISO 3166-2 subdivision codes
📍 Lat() / Lng() — nil-safe coordinate accessors returning float64
🔍 HasCoordinates() — predicate to disambiguate absent vs real 0,0
📝 README accuracy — nil-safety docs updated for numeric zero values
🧹 Accessor ordering — reordered to match struct field layout for scanability

Added

  • RegionCode() accessor — returns the ISO 3166-2 subdivision code (e.g. "CA"), nil-safe
  • Lat() accessor — returns latitude coordinate, nil-safe
  • Lng() accessor — returns longitude coordinate, nil-safe
  • HasCoordinates() predicate — distinguishes absent coordinates from a real 0,0 location

Changed

  • README "Response Shape" section now uses RegionCode(), Lat(), Lng() accessors instead of raw field access

Fixed

  • README nil-safety note now correctly states accessors return zero values (empty strings or 0), not just "empty strings"

v1.1.0 — Account Management, WithTimeout Fix, errors.As Predicates

Choose a tag to compare

@tomvoss tomvoss released this 13 Jun 18:48
f6976cf

NetLoc8 Go SDK v1.1.0 adds the full account management API surface — profile, API keys, usage statistics, audit log, and allowed origins — bringing the SDK to feature parity with the authenticated API. This release also fixes several pre-existing issues surfaced during code review.

Highlights

🔑 10 new account management endpointsGetProfile, ListKeys, CreateKey, DeleteKey, RenewKey, GetUsage, GetAuditLog, ListSites, CreateSite, DeleteSite
🛠️ POST & DELETE transport — new doPost and doDelete internal methods extend the HTTP layer
🐛 WithTimeout ordering fix — timeout no longer silently lost when called before WithHTTPClient
🔒 errors.As predicatesIsNotFound, IsRateLimited, IsForbidden now work with wrapped errors
📖 Full documentation — godoc examples, README method tables, CHANGELOG
64 tests passing — comprehensive coverage for all endpoints with zero new dependencies


Added

  • doPost and doDelete internal HTTP transport methods on Client for POST and DELETE API calls
  • Account management types: Profile, APIKey, CreatedKey, Usage, AuditEntry, AuditLog, Site
  • Functional option types: CreateKeyOption (WithKeyType), AuditLogOption (WithLimit, WithOffset, WithAction)
  • Client methods: GetProfile, ListKeys, CreateKey, DeleteKey, RenewKey, GetUsage, GetAuditLog, ListSites, CreateSite, DeleteSite
  • Comprehensive test coverage for all account management endpoints (25 tests)
  • Package documentation with usage examples for account management, usage statistics, audit log, and allowed origins
  • Runnable Example tests for CreateKey, GetUsage, GetAuditLog
  • Account management methods table in README
  • TestNewClient_TimeoutOrdering test proving option ordering is safe

Fixed

  • WithTimeout ordering bug: timeout was silently lost when called before WithHTTPClient
  • IsNotFound, IsRateLimited, IsForbidden now use errors.As instead of direct type assertion, so they work with wrapped errors
  • doPost no longer sends Content-Type: application/json when body is nil (e.g. RenewKey)
  • Removed false NETLOC8_API_KEY env var fallback claim from README (was never implemented)
  • TestClient_CreateKey_NoType assertion was trivially true; now properly checks the type key is absent

v1.0.0 — Stable Release

Choose a tag to compare

@tomvoss tomvoss released this 30 Apr 21:07

NetLoc8 Go SDK v1.0.0

The official Go client for the NetLoc8 IP geolocation API. Zero dependencies beyond the standard library.

Install

go get github.com/netloc8/netloc8-go@v1.0.0

Highlights

  • Full API coverageLookupIP, LookupMe, Timezone, MyTimezone, Validate
  • Functional optionsWithTimeout, WithHTTPClient, WithBaseURL, WithUserAgent, WithOrigin
  • Proxy-aware — pass a custom *http.Client with a proxy transport to discover exit IPs
  • Nil-safe accessorsgeo.CountryCode(), geo.CityName(), geo.TZ() never panic
  • Typed errors*APIError with IsNotFound, IsRateLimited, IsForbidden predicates
  • IP utilitiesNormalizeIP, IsPublicIP, Subnet, ParseIP, IsIPv4, IsIPv6
  • HelpersIsEU for GDPR compliance, GetClientIP for reverse proxy header extraction
  • 110 tests with race detection clean

Quick Start

client := netloc8.NewClient( "sk_your_secret_key" )

geo, err := client.LookupIP( context.Background(), "8.8.8.8" )

fmt.Println( geo.CountryCode() ) // "US"
fmt.Println( geo.CityName() )   // "Mountain View"
fmt.Println( geo.TZ() )         // "America/Los_Angeles"
fmt.Println( geo.ASN() )        // "AS15169"

License

Elastic License 2.0 (ELv2)