{"id":15107043,"url":"https://github.com/jmoney/cidr-encoder","last_synced_at":"2026-01-18T22:33:56.306Z","repository":{"id":243297466,"uuid":"812042833","full_name":"jmoney/cidr-encoder","owner":"jmoney","description":"CLI for time efficiently encoding cidr blocks to find if an IP exists in a range","archived":false,"fork":false,"pushed_at":"2025-01-01T03:15:02.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-13T09:53:48.223Z","etag":null,"topics":["github-site","homebrew-formula","license-management","mkdocs"],"latest_commit_sha":null,"homepage":"https://www.jmoney.dev/cidr-encoder","language":"Go","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/jmoney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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":"jmoney"}},"created_at":"2024-06-07T20:47:57.000Z","updated_at":"2024-06-13T02:19:37.000Z","dependencies_parsed_at":"2024-09-16T08:53:47.621Z","dependency_job_id":null,"html_url":"https://github.com/jmoney/cidr-encoder","commit_stats":null,"previous_names":["jmoney/cidr-encoder"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jmoney/cidr-encoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmoney%2Fcidr-encoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmoney%2Fcidr-encoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmoney%2Fcidr-encoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmoney%2Fcidr-encoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmoney","download_url":"https://codeload.github.com/jmoney/cidr-encoder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmoney%2Fcidr-encoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28552785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["github-site","homebrew-formula","license-management","mkdocs"],"created_at":"2024-09-25T21:04:04.740Z","updated_at":"2026-01-18T22:33:56.285Z","avatar_url":"https://github.com/jmoney.png","language":"Go","funding_links":["https://github.com/sponsors/jmoney"],"categories":[],"sub_categories":[],"readme":"# Cidr Encoder\n\nConverts a list of CIDRs to an encoded file for time efficient lookups on is a given IP address in any of the CIDR blocks.  Each CIDR block is on its own line in the input file.  The output file is a binary file that can be read by the `cidr-encoder` program for searching.  The lookup time is `O(1)` for any IP address.  However, to achieve this the output file can easily be several GBs if there are a wide range of CIDR blocks across the IPv4 addresses space.\n\nThe calculation for how big a file would take is effectively the largest IP - the smallest IP.  As the algorithm uses file offsets to determine if an IP is in a list of CIDR blocks, the largest IP is the largest offset in the file.  We use the smallest IP to normalize everything to first offset of a file.  This is done to reduce the size of the file so the difference between the two is the size of the file.\n\n## Usage\n\n```bash\n$ cidr-encoder -h\nUsage of cidr-encoder:\n  -calc\n        Calculate the size of the encoded file. Reads from STDIN.\n  -encode\n        Encode the CIDRs. Reads from STDIN.\n  -name string\n        The file base name to use as the ACL file name(e.g test.acl name is test).\n  -search string\n        Search for a IP in the CIDRs.\n```\n\n`-calc`, `encode`, and `search` are all mutually exclusive but the priority in the event that all are specified are `calc` then `encode` then `search`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmoney%2Fcidr-encoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmoney%2Fcidr-encoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmoney%2Fcidr-encoder/lists"}