{"id":22546531,"url":"https://github.com/prx/prx-ip-filter","last_synced_at":"2025-03-28T08:45:49.894Z","repository":{"id":57331914,"uuid":"206179658","full_name":"PRX/prx-ip-filter","owner":"PRX","description":"Utility for filtering traffic using secret lists of IP ranges","archived":false,"fork":false,"pushed_at":"2019-09-04T18:44:42.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T12:29:09.055Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PRX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-03T22:00:29.000Z","updated_at":"2019-09-04T18:44:44.000Z","dependencies_parsed_at":"2022-09-21T03:44:03.457Z","dependency_job_id":null,"html_url":"https://github.com/PRX/prx-ip-filter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRX%2Fprx-ip-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRX%2Fprx-ip-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRX%2Fprx-ip-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRX%2Fprx-ip-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PRX","download_url":"https://codeload.github.com/PRX/prx-ip-filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245999320,"owners_count":20707554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-07T15:08:08.800Z","updated_at":"2025-03-28T08:45:49.874Z","avatar_url":"https://github.com/PRX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PRX IP Filter\n\n[![license](https://img.shields.io/github/license/PRX/prx-ip-filter.svg)](LICENSE)\n[![npm](https://img.shields.io/npm/v/prx-ip-filter.svg)](https://www.npmjs.com/package/prx-ip-filter)\n[![npm](https://img.shields.io/npm/dt/prx-ip-filter.svg)](https://www.npmjs.com/package/prx-ip-filter)\n[![build status](https://travis-ci.org/PRX/prx-ip-filter.svg?branch=master)](https://travis-ci.org/PRX/prx-ip-filter)\n\n## Description\n\nUtility for matching client IP addresses against a list of IP ranges.\n\nThis list can be built manually (by adding CIDRs and IP ranges) or loading from\nan S3 location.\n\n## Install\n\nJust `npm install --save prx-ip-filter`.\n\n## Usage\n\n```node\nconst PrxIpFilter = require('prx-ip-filter');\nconst filter = new PrxIpFilter();\n\nfilter.addRange('1.1.1.1', '1.1.255.255', 'Some Datacenter');\nfilter.addRange('9:9:9:9::', '9:9:9:9:ffff:ffff:ffff:ffff', 'Something Else');\n\nconsole.log(filter.check('1.1.99.99'));\n# \"Some Datacenter\"\nconsole.log(filter.check('9:9:9:9:abcd::'));\n# \"Something Else\"\nconsole.log(filter.check('1.2.1.1'));\n# null\n```\n\nYou can also serialize the current list of IP ranges to JSON, and load it from\nJSON:\n\n```node\nfilter.addRange('1.1.1.1', '1.1.255.255', 'Some Datacenter');\nconst json = JSON.stringify(filter);\nconsole.log(json);\n# \"{\"names\":[\"Some Datacenter\"],\"ipv4\":[\"001.001.001.001\",\"001.001.255.255\",0],\"ipv6\":[]}\"\n\nconst filter2 = PrxIpFilter.fromJSON(json);\nconsole.log(filter2.names);\n# [\"Some Datacenter\"]\n\nawait filter.toFile('/path/to/filters.json');\nconst filter3 = await PrxIpFilter.fromFile('/path/to/filters.json');\nconsole.log(filter3.names);\n# [\"Some Datacenter\"]\n```\n\nAdditionally, you can load load filters from 1 or more CSV files in S3, where\neach line has the format `ipLow,ipHigh,name` or `cidr,name`:\n\n```node\nconst filter = await PrxIpFilter.fromS3CSV('my-bucket-name', 'some-prefix-path');\n```\n\n## Development\n\nTests are run by Jest, and located in the `*.test.js` files. Write good tests.\n\n## License\n\n[MIT License](LICENSE)\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (git checkout -b feat/my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin feat/my-new-feature)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprx%2Fprx-ip-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprx%2Fprx-ip-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprx%2Fprx-ip-filter/lists"}