{"id":18508084,"url":"https://github.com/imqueue/net","last_synced_at":"2025-10-16T06:31:53.669Z","repository":{"id":57118450,"uuid":"430359895","full_name":"imqueue/net","owner":"imqueue","description":"Fast and reliable binary network address checker for node with IPv4 \u0026 IPv6 support","archived":false,"fork":false,"pushed_at":"2025-07-04T09:20:29.000Z","size":329,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-20T06:37:05.061Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imqueue.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-21T12:28:36.000Z","updated_at":"2025-07-04T09:20:33.000Z","dependencies_parsed_at":"2022-08-23T05:20:57.935Z","dependency_job_id":"f7762499-39e8-4a95-9642-e0e57729382e","html_url":"https://github.com/imqueue/net","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"81c80abbc648b3ca4466686086d04ec3aee807fd"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/imqueue/net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imqueue","download_url":"https://codeload.github.com/imqueue/net/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279162687,"owners_count":26117257,"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","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-06T15:13:21.430Z","updated_at":"2025-10-16T06:31:53.663Z","avatar_url":"https://github.com/imqueue.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e\n    @imqueue/net\n    \u003ca href=\"https://twitter.com/intent/tweet?text=Fast%20and%20reliable%20binary%20networks%20checker%20for%20node\u0026url=https://github.com/imqueue/net\u0026via=github\u0026hashtags=typescript,javascript,nodejs,postgres,developers\"\u003e\n        \u003cimg src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social\" alt=\"Tweet\"\u003e\n    \u003c/a\u003e\n\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://app.travis-ci.com/github/imqueue/net\"\u003e\n        \u003cimg src=\"https://travis-ci.com/imqueue/net.svg?branch=master\" alt=\"Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://rawgit.com/imqueue/net/master/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-ISC-blue.svg\" alt=\"Coverage Status\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003cp align=\"center\"\u003e\n    \u003cstrong\u003e\n        Fast and reliable binary networks checker for node with IPv4 \u0026 IPv6 full\n        support\n    \u003c/strong\u003e\n\u003c/p\u003e\n\u003chr\u003e\n\n## What Is This?\n\nThis library provides a clean way to create binary network lists with binary \nsearch over them to lookup for an addresses present in that lists.\n\nIt provides lookup in O(log n) time with very small memory footprint to store\nnetwork lists.\n\n## Install\n\nAs easy as:\n\n~~~bash\nnpm i --save @imqueue/net\n~~~ \n\n## Usage \u0026 API\n\nThere are 2 basic objects to deal with `NetworkList` and `Networks` which allow\ndoing lookups over the network lists. As long as you need to deal with a single\nnetwork type (IPv4 or IPv6) it is recommended to use `NetworkList` type.\nOtherwise, if you need work with mixed networks at once - use `Networks` type \ninstead. See examples below:\n\n~~~typescript\nimport { Networks, NetworkList } from '@imqueue/net';\n\n// ---------------------------------\n// Workinf with IPv4 networks\n// ----------------------------------\n\nconst ipv4reserved = new NetworkList([\n    '0.0.0.0/8',\n    '10.0.0.0/8',\n    '100.64.0.0/10',\n    '127.0.0.0/8',\n    '169.254.0.0/16',\n    '172.16.0.0/12',\n    '192.0.0.0/24',\n    '192.88.99.0/24',\n    '192.168.0.0/16',\n    '198.18.0.0/15',\n    '198.51.100.0/24',\n    '203.0.113.0/24',\n    '224.0.0.0/4',\n    '233.252.0.0/24',\n    '240.0.0.0/4',\n    '255.255.255.255/32',\n]);\n\nconst addressOne = '192.168.1.34';\nconst addressTwo = '193.168.1.34';\n\n// perform checks\nconsole.log(addressOne, 'is reserved:', ipv4reserved.includes(addressOne)); // true\nconsole.log(addressTwo, 'is reserved:', ipv4reserved.includes(addressTwo)); // false\n\n// network list can be converted to CIDR array\nconsole.log(ipv4reserved.toArray());\n\n// network list can be converted to list of network ranges [min, max][]\nconsole.log(ipv4reserved.toIntArray());\n\n// network list is JSON-serializable\nconsole.log(JSON.stringify(ipv4reserved));\n\n// audit properties:\nconsole.log(ipv4reserved);\n\n// ---------------------------------\n// IPv6 networks\n// ---------------------------------\n\nconst ipv6reserved = new NetworkList([\n    '::/128',\n    '::1/128',\n    '::ffff:0:0/96',\n    '::ffff:0:0:0/96',\n    '64:ff9b::/96',\n    '64:ff9b:1::/48',\n    '100::/64',\n    '2001:0000::/32',\n    '2001:20::/28',\n    '2001:db8::/32',\n    '2002::/16',\n    'fc00::/7',\n    'fe80::/10',\n    'ff00::/8',\n]);\n\nconst ipv6One = 'fc00::42';\nconst ipv6Two = 'dead::beef';\n\n// perform checks\nconsole.log(ipv6One, 'is reserved:', ipv6reserved.includes(ipv6One)); // true\nconsole.log(ipv6Two, 'is reserved:', ipv6reserved.includes(ipv6Two)); // false\n\n// network list can be converted to CIDR array\nconsole.log(ipv6reserved.toArray());\n\n// network list can be converted to list of network ranges [min, max][]\nconsole.log(ipv6reserved.toIntArray());\n\n// network list is JSON-serializable\nconsole.log(JSON.stringify(ipv6reserved));\n\n// audit properties:\nconsole.log(ipv6reserved);\n\n// ---------------------------------\n// Working with mixed (IPv4/IPv6) networks\n// ---------------------------------\n\nconst allReserved = new Networks([\n    '0.0.0.0/8',\n    '10.0.0.0/8',\n    '100.64.0.0/10',\n    '127.0.0.0/8',\n    '169.254.0.0/16',\n    '172.16.0.0/12',\n    '192.0.0.0/24',\n    '192.88.99.0/24',\n    '192.168.0.0/16',\n    '198.18.0.0/15',\n    '198.51.100.0/24',\n    '203.0.113.0/24',\n    '224.0.0.0/4',\n    '233.252.0.0/24',\n    '240.0.0.0/4',\n    '255.255.255.255/32',\n    '::/128',\n    '::1/128',\n    '::ffff:0:0/96',\n    '::ffff:0:0:0/96',\n    '64:ff9b::/96',\n    '64:ff9b:1::/48',\n    '100::/64',\n    '2001:0000::/32',\n    '2001:20::/28',\n    '2001:db8::/32',\n    '2002::/16',\n    'fc00::/7',\n    'fe80::/10',\n    'ff00::/8',\n]);\n\nconsole.log(allReserved.includes('fc00::dead:beef')); // true\nconsole.log(allReserved.includes('dead::beef')); // false\nconsole.log(allReserved.includes('193.1.1.1')); // false\nconsole.log(allReserved.includes('172.16.1.1')); // true\n\n// network list can be converted to CIDR array\nconsole.log(allReserved.toArray());\n\n// network list can be converted to list of network ranges [min, max][]\nconsole.log(allReserved.toIntRanges());\n\n// network list is JSON-serializable\nconsole.log(JSON.stringify(allReserved));\n\n// audit properties:\nconsole.log(allReserved);\n~~~\n\n## Contributing\n\nAny contributions are greatly appreciated. Feel free to fork, propose PRs, open\nissues, do whatever you think may be helpful to this project. PRs which passes\nall tests and do not brake tslint rules are first-class candidates to be\naccepted!\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\nSee the [LICENSE](LICENSE)\n\nHappy Coding!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimqueue%2Fnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fnet/lists"}