add: [tools] generator for public-ipfs-gateways - #381
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0121gk7vaCXX9bMri7tC9XVd
| try: | ||
| with open(get_abspath_list_file("public-ipfs-gateways")) as existing_file: | ||
| hostnames.update(json.load(existing_file)["list"]) | ||
| except (IOError, OSError, ValueError, KeyError): |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds
tools/generate-public-ipfs-gateways.py, an automated generator for the previously hand-maintainedlists/public-ipfs-gateways/list.json(frozen since 2025-03-19), and registers it ingenerate_all.sh.Source
The requested source, https://ipfs.github.io/public-gateway-checker/, is a client-side JS SPA and cannot be scraped with
requests. It renders from two JSON data files in the same GitHub repo, which the generator fetches directly:https://raw.githubusercontent.com/ipfs/public-gateway-checker/main/gateways.jsonhttps://raw.githubusercontent.com/ipfs/public-gateway-checker/main/onion-gateways.jsonBoth verified to return HTTP 200 with small JSON arrays of gateway origin URLs (e.g.
"https://ipfs.filebase.io").Normalization
Each entry is parsed with
urlparse(...).hostnameto strip scheme, port, path and any legacy:hashplaceholder, then lowercased and trailing-dot-stripped, matching the bare-hostname shape already used by the existing list (type: string,matching_attributes: domain/hostname/domain|ip/url/uri).Important: list size will shrink significantly (89 -> 14)
This is a genuine upstream change, not a bug. Upstream commit
73103999("chore: trim gateway list", 2026-08-21) deliberately removedipfs.io,dweb.link, andtrustless-gateway.linkbecause bots/scrapers were probing all three shared-backend hostnames, tripling non-organic load; commit782d89aaremoved further dead gateways. Only 3 of the original 89 MISP entries survive unchanged (4everland.io,gateway.pinata.cloud,ipfs.cyou);storry.tvsurvives as a rename (ipfs.storry.tv). This PR (script + generate_all.sh only, per the intended two-PR split) does not itself changelist.jsoncontent review scope, but running the generator will produce a much smaller list — flagging this explicitly for review rather than shipping it silently.Validation
jsonschema -i lists/public-ipfs-gateways/list.json schema.json-> exit 0tools/validate_values.py-> exit 0generators.logshows no ERROR/WARNING for this rungenerate_all.shentry inserted next togenerate-github.pyrather than appended at the end, to avoid colliding with other in-flight PRs🤖 Generated with Claude Code
https://claude.ai/code/session_0121gk7vaCXX9bMri7tC9XVd