Skip to content

v0.2.1 - Simple API & Sendable Fix

Choose a tag to compare

@dweekly dweekly released this 24 Nov 21:38
· 41 commits to main since this release

What's New

Simple IP2ASN API

New top-level API for the easiest possible usage:

// Embedded (sync, no network)
let db = try IP2ASN.embedded()

// Remote (async, auto-updates from CDN)
let db = try await IP2ASN.remote()

// Offline-first (bundled + auto-update)
let db = try await IP2ASN.remote(bundledPath: Bundle.main.path(forResource: "ip2asn", ofType: "ultra"))

UltraCompactDatabase is now Sendable

Breaking change fix: UltraCompactDatabase is now a Sendable struct (was class). This allows it to be safely passed across actor boundaries, which is required for Swift 6 strict concurrency.

let db = try IP2ASN.embedded()

// Now works - passes across actor boundary
await Task.detached {
    let result = db.lookup("8.8.8.8")
}.value

Migration

If you were using EmbeddedDatabase.loadUltraCompact() or RemoteDatabase, those still work. The new IP2ASN API is just a simpler wrapper.

Full Changelog: v0.2.0...v0.2.1