You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Legacy IP responses can cause result-image generation to panic because missing location metadata is sent as an empty string instead of an object or omitted field.
This PR extends the Rust backend’s ISP lookup with approximate IP-derived location metadata, addressing the backend portion of librespeed/speedtest#881 while preserving existing response fields.
Changes:
Adds unauthenticated IPinfo requests alongside API-key support and improves HTTP JSON response handling.
Expands MMDB fallback with configurable database paths, optional city data, and structured location metadata.
Preserves location data in worker status and telemetry, with supporting tests and documentation.
File
Description
src/ip/mmdb/mmdb_record.rs
Normalizes country, ASN, and city database records.
src/ip/mmdb/mmdb_reader.rs
Adds city lookups, safer IP parsing, and a regression test.
src/ip/ip_info.rs
Builds and merges API/MMDB ISP and location responses.
src/http/response.rs
Updates test configuration for MMDB paths; otherwise formatting.
src/http/http_client.rs
Revises response reading and adds chunked JSON decoding tests.
src/config/mod.rs
Adds database path settings, defaults, aliases, and overrides.
src/cmd.rs
Exposes country/ASN and city database path options.
README.md
Documents location metadata and lookup configuration.
configs.toml
Adds database paths and explains keyless API behavior.
CHANGELOG.md
Records the ISP and location enhancements.
assets/speedtest_worker.js
Carries location metadata into status and telemetry.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The API-first path can panic on TLS handshake failures instead of falling back to MMDB, while location serialization and merging can produce missing country names, conflicting geographic data, and invalid coordinates.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unchecked UTF-8 slicing of ASN values can panic and abort getIP requests, while continent merges can produce locations inconsistent with the retained country.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Non-ASCII ASN can panic during prefix slicing
src/ip/ip_info.rs:804
ASN strings are accepted from API/MMDB data without an ASCII restriction, but slicing asn[..2] panics when byte 2 is inside a UTF-8 character. For example, asn_codes_match("€", "AS8075") panics, aborting the getIP request during the offline merge. Use a checked prefix lookup so malformed ASN values can be handled without panicking.
Continent fields ignore country compatibility
src/ip/ip_info.rs:423
The country-code guard protects the country name, but these continent fields are still copied when the providers disagree. For example, an API result with country US and a country MMDB result with country DE produces country: "US" alongside continent: "EU". Apply the same country compatibility check to both continent fields so the structured location remains consistent.
Offline merge can pair country with wrong continent
src/ip/ip_info.rs:491
The offline-only path retains the city database's country but unconditionally assigns the country/ASN database's continent. If the city database reports DE and the country/ASN database reports US, this returns Germany with continent NA/North America. Only copy these fields when the source country is compatible with the retained country.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The IP-info opt-out still exposes ISP/location data through getIP responses and telemetry logs, while conflicting MMDB records can produce inconsistent country and continent values.
All implementation and review follow-ups are complete: safe legacy telemetry, bounded keyless API lookup, reader caching, ASN/country matching, country/coordinate validation, MMDB bounds, and city/country fallback behavior. Build, 19 tests, Clippy, live API/MMDB checks, and diff validation pass. The PR remains open and mergeable and is linked to librespeed/speedtest#881.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because an unpublished finding shows that conflicting database results can produce inconsistent country and continent metadata.
Latest-head audit complete at 12c3445. All 14 review threads are resolved, PR 53 remains open and mergeable, and the keyless/API-first, MMDB, country/continent, coordinate, legacy telemetry, and disable_ipinfo privacy behaviors are covered by focused regressions. Validation passes: cargo fmt --check, cargo check, cargo test --quiet (22 tests), cargo clippy --all-targets --all-features -- -D warnings, live API/MMDB opt-out checks, and git diff --check.
@sudodios Latest head d5078f5 is ready for maintainer review. The Rust provider chain now resolves public IPs through cached local MMDB first, with private-IP bypass, keyed/keyless ipinfo supplement/fallback, a 5-second timeout, failure cooldown, and disable_ipinfo IP-only behavior. The getIP wire shape preserves processedString/rawIspInfo and adds validated countryName/location metadata while guarding country/continent and coordinate conflicts. Privacy handling now removes ISP/location/log data for opt-out and historical rendering. Validation passes: cargo fmt --check, cargo check, cargo test --quiet (23 tests), cargo clippy --all-targets --all-features -- -D warnings, git diff --check, plus live public/private/disable/invalid-key checks. All 14 inline threads are resolved; PR 53 remains open and mergeable. Cross-repo work is tracked in librespeed/speedtest-go PR 96 and linked issue 881.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Address-specific misses, including successful bogon responses, trigger a global 30-second IPinfo cooldown that unnecessarily blocks lookups for unrelated public clients.
@sudodios Latest head 3ab12db is ready for maintainer review. The latest audit finding is fixed: successful bogon/empty ipinfo responses no longer trigger the global provider cooldown; only transport/status/timeout failures do. Live 100.64.0.1 bogon checks were repeated with no cooldown side effect. Validation passes: cargo fmt --check, cargo check, cargo test --quiet (24 tests), cargo clippy --all-targets --all-features -- -D warnings, git diff --check, plus live public/private/disable/invalid-key/bogon checks. All review threads are resolved. PR 53 remains open and mergeable.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The cooldown tests share global state and can run concurrently, causing sporadic failures unless both complete test sequences are serialized with the same test-only mutex.
@billmcilhargey Latest Rust backend head 71043d2 is ready for re-review. Global cooldown tests are serialized across setup/assertion/cleanup so they cannot interfere with each other; 24 tests plus check/strict Clippy pass. PR remains open and mergeable.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because an unpublished finding indicates the offline fallback can return inconsistent country and continent metadata when its databases disagree.
@sudodios Fresh latest-head audit complete at 71043d2. All 16 inline review threads are resolved, PR 53 remains open and mergeable, and no concrete unresolved comment or CI/status item remains. The provider policy is MMDB-first with private-IP bypass, keyed/keyless ipinfo supplement/fallback, timeout/cooldown controls, bogon handling, and disable_ipinfo IP-only behavior. The response shape preserves processedString/rawIspInfo and validated countryName/location metadata; continent/country and coordinate conflicts are guarded. Validation passes: cargo fmt --check, cargo check, cargo test --quiet (24 tests), cargo clippy --all-targets --all-features -- -D warnings, git diff --check, plus live public/private/disable/invalid-key/bogon checks. Cross-repo: linked Go PR 96 and issue 881 remain open; PR 96 inline threads are resolved, with Maddie’s formal CHANGES_REQUESTED review still pending latest-head re-review.
@billmcilhargey Latest Rust backend head 71043d2 passed cargo fmt/check/test/Clippy with serialized cooldown tests. Remaining inline thread is resolved and the PR remains open and mergeable.
@sudodios Latest fresh audit complete on head 71043d2. All 16 inline threads are resolved and no unresolved human/comment/CI finding remains. PR 53 remains open and mergeable. Validation passes: cargo fmt --check, cargo check, cargo test --quiet (24 tests), cargo clippy --all-targets --all-features -- -D warnings, git diff --check, plus live public/private/disable/invalid-key/bogon checks. The linked Go PR 96 currently remains CHANGES_REQUESTED and conflicting with upstream master; that follow-up PR’s inline threads are resolved but Maddie’s formal re-review and conflict resolution are still pending.
Latest-head status: Rust backend PR 53 is open and mergeable at 71043d2, with 0 unresolved review threads. No merge or close.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
cargo test --quietpasses 12 tests.128.94.2.134API-first and MMDB fallback paths.Context
Fixes librespeed/speedtest#881 for the Rust backend.