{"id":"ccuser44/rapid-match-domain","name":"rapid-match-domain","scope":"ccuser44","platform":"roblox","description":"A fast Lua library to check if a domain name in a list of domain names with wildcard, subdomain and IP address support.","version":"1.0.3","latest":"1.0.3","versions":["1.0.0","1.0.2","1.0.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"745acdd7962981818b69bc62e4e64c4e73ced6ba20428c2e08a93edfb5ce67de","likes":0,"downloads":0,"install":"forest install ccuser44/rapid-match-domain","url":"https://forest.dev/p/roblox/ccuser44/rapid-match-domain","files":"https://api.forest.dev/ai/package/roblox/ccuser44/rapid-match-domain/files","readme":"<div align=\"center\">\r\n\r\n# ⚡ RapidMatchDomain ⚡\r\n\r\n![A diagram showing the implementation](https://upload.wikimedia.org/wikipedia/commons/d/d2/DNS_schema.svg)\r\n> [Diagram image](https://commons.wikimedia.org/wiki/File:DNS_schema.svg) is under CC BY-SA 2.5 from Wikimedia\r\n\r\n</div>\r\n\r\n---\r\n\r\nA fast Lua library to check if a domain name in a list of domain names. Wildcards, subdomains and IP addresses supported.\r\nIt has O(1) complexity meaning even with 2 million domains it doesn't lag a tiny bit more.\r\n\r\nFor example the library is ideal for security to see if domains and/or IP addresses are in a blocklist.\r\n\r\n## Installing\r\n\r\n### Installing via LuaRocks\r\n\r\nRun `$ luarocks install rapid-match-domain`\r\n\r\n### Installing via Lit\r\n\r\nWork in progess...\r\n\r\n### Instaling via Wally\r\n\r\nWork in progess...\r\n\r\n### Installing standalone\r\n\r\nWork in progess...\r\n\r\n## Usage\r\n\r\n### Requiring the library\r\n\r\nTo require the module use the following Lua code at the top of your script:\r\n\r\n```lua\r\nlocal rapidMatch = require(\"rapid-match-domain\")\r\n```\r\n\r\nIf you want you can use anything else than `rapidMatch` as the variable name for the library.\r\n\r\n---\r\n\r\n### Initialization of the domain List\r\n\r\nThe following Lua code initiates an empty table `t` to store a list of domain names:\r\n\r\n```lua\r\nlocal t = {}\r\n```\r\n\r\n---\r\n\r\n### Adding domains to the List\r\n\r\nThe next piece of code adds the specified domain names to the existing list. This operation can be performed multiple times with different domain lists:\r\n\r\n```lua\r\nrapidMatch.addUrls(t, domains, true)\r\n```\r\n\r\n**Parameters:**\r\n- `t` (table): The table storing the list of domain names.\r\n- `domains` (table | string): A table or a newline seperated string containing the domain names to be added to the list.\r\n- `useSubdomains` (boolean?) : A boolean telling if domains being matched againts the list would still match if they have extra subdomains. Default value is true.\r\n\r\n---\r\n\r\n### Matching a domain against the List\r\n\r\nThe final piece of code shows how to check if a domain matches any of the domain names in the list:\r\n\r\n```lua\r\nif rapidMatch.match(t, \"www.example.com\") then\r\n-- The domain matches\r\nend\r\n```\r\n\r\n**Parameters:**\r\n- `t` (table): The table storing the list of domain names.\r\n- `\"www.example.com\"` (string): The domain name to match against the list.\r\n\r\n**Returns:**\r\n- `true` if the domain matches any entry in the list.\r\n- `false` if the domain does not match any entry in the list.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- 🔥 Wildcard support\r\n- 🔍 Matching with and without subdomains\r\n- 🌐 IPv4, full IPv6 addresses and portnumbers supported\r\n- 🌍 Wildcards and subdomain support allow rudimentary IP range checking\r\n- ⚡ Super simple implementation, no bloat, 80 lines of Lua in total\r\n- ⏱️ Amount of domains in the list to be checked againts doesn't increase the complexity, will always be as fast as O(1) amount of domains in the checklist\r\n","readmeBorrowedFrom":{"version":"1.0.2","source":"wally"},"readmeTruncated":false}