{"id":17783510,"url":"https://github.com/skalt/container_image_dist_ref","last_synced_at":"2026-02-17T20:31:58.262Z","repository":{"id":217598604,"uuid":"738596501","full_name":"SKalt/container_image_dist_ref","owner":"SKalt","description":"A library for parsing OCI container image references","archived":false,"fork":false,"pushed_at":"2025-01-28T13:21:35.000Z","size":293,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T03:40:01.474Z","etag":null,"topics":["docker","oci-distribution","oci-image","parser"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SKalt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"skalt"}},"created_at":"2024-01-03T15:40:37.000Z","updated_at":"2025-01-28T13:21:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1cce1af-6f88-452e-a327-daaf6c17f6aa","html_url":"https://github.com/SKalt/container_image_dist_ref","commit_stats":null,"previous_names":["skalt/container_image_dist_ref"],"tags_count":5,"template":false,"template_full_name":"SKalt/rust-nix-project-template","purl":"pkg:github/SKalt/container_image_dist_ref","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SKalt%2Fcontainer_image_dist_ref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SKalt%2Fcontainer_image_dist_ref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SKalt%2Fcontainer_image_dist_ref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SKalt%2Fcontainer_image_dist_ref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SKalt","download_url":"https://codeload.github.com/SKalt/container_image_dist_ref/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SKalt%2Fcontainer_image_dist_ref/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29557239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T20:14:27.083Z","status":"ssl_error","status_checked_at":"2026-02-17T20:14:26.018Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","oci-distribution","oci-image","parser"],"created_at":"2024-10-27T07:43:04.899Z","updated_at":"2026-02-17T20:31:53.245Z","avatar_url":"https://github.com/SKalt.png","language":"Rust","funding_links":["https://github.com/sponsors/skalt"],"categories":[],"sub_categories":[],"readme":"# container_image_dist_ref\n\nA docker/OCI image reference parser.\n\n[![Crates.io](https://img.shields.io/crates/v/container_image_dist_ref.svg)](https://crates.io/crates/container_image_dist_ref)\n[![docs.rs](https://img.shields.io/docsrs/container_image_dist_ref)](https://docs.rs/container_image_dist_ref/latest/container_image_dist_ref/)\n\nThis library is extensively tested against the authoritative image reference implementation, https://github.com/distribution/reference.\n\nImage references follow this [EBNF](https://www.w3.org/TR/xml11/#sec-notation) grammar:\n\n\u003c!-- {{{sh cat ./grammars/reference.ebnf }}}{{{out skip=2 --\u003e\n\n```ebnf\nreference            ::= name (\":\" tag )? (\"@\" digest )?\nname                 ::= (domain \"/\")? path\ndomain               ::= host (\":\" port-number)?\nhost                 ::= domain-name | IPv4address | \"[\" IPv6address \"]\" /* see https://www.rfc-editor.org/rfc/rfc3986#appendix-A */\ndomain-name          ::= domain-component (\".\" domain-component)*\ndomain-component     ::= ([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\nport-number          ::= [0-9]+\npath-component       ::= [a-z0-9]+ (separator [a-z0-9]+)*\npath                 ::= path-component (\"/\" path-component)*\nseparator            ::= [_.] | \"__\" | \"-\"+\n\ntag                  ::= [\\w][\\w.-]{0,127}\n\ndigest               ::= algorithm \":\" encoded\nalgorithm            ::= algorithm-component (algorithm-separator algorithm-component)*\nalgorithm-separator  ::= [+._-]\nalgorithm-component  ::= [A-Za-z][A-Za-z0-9]*\nencoded              ::= [a-fA-F0-9]{32,} /* At least 128 bit digest value */\n\nidentifier           ::= [a-f0-9]{64}\n```\n\n\u003c!-- }}} skip=2 --\u003e\n\n(This is translated from [https://github.com/distribution/reference/blob/main/reference.go](https://github.com/distribution/reference/blob/main/reference.go#L4-L26))\n\nTo avoid worst-case performance, image references are restricted further:\n\n| part        | maximum length |\n| ----------- | -------------: |\n| `name`      |            255 |\n| `tag`       |            127 |\n| `digest`    |           1024 |\n| `algorithm` |            255 |\n\n## Motivation\n\n\u003c!-- TODO: rewrite --\u003e\n\nI wanted to use `distribution/reference` in a rust project, but didn't want to deal with FFI into `go`.\n\n## Goals\n\n1. fidelity to the `distribution/reference`'s parser\n1. fun optimizations!\n\u003c!-- 1. The eventual ability to re-use the parser in other languages --\u003e\n\nMore about these goals and design choices in [`./ARCHITECTURE.md`](./ARCHITECTURE.md).\n\n## Benchmarks\n\nBased on some naive benchmarking, this library achieves at least a 10x speedup compared to distribution/reference.\n\n\u003cdetails open\u003e\u003csummary\u003eRunning the benchmarks\u003c/summary\u003e\n\n```sh\n#!/bin/bash\ncargo bench # rust\n( # go\n  cd internal/reference_oracle \u0026\u0026\n  go test -bench=.\n)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eBenchmarks on my machine\u003c/summary\u003e\n\ndistribution/reference:\n\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/skalt/container_image_dist_ref/internal/reference_oracle\ncpu: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz\nBenchmarkOracleEntireTestSuite-8            9218            148438 ns/op\n```\n\nThis crate:\n\n```\nentire_test_suite       time:   [5.0737 µs 5.1349 µs 5.2047 µs]\n```\n\n```\nspeedup = (148438 ns) / ((5.1349 µs) * (1000 ns / µs)) = 28.908\n```\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskalt%2Fcontainer_image_dist_ref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskalt%2Fcontainer_image_dist_ref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskalt%2Fcontainer_image_dist_ref/lists"}