{"id":21515656,"url":"https://github.com/sqreen/tor-test","last_synced_at":"2025-10-06T18:38:49.531Z","repository":{"id":57150282,"uuid":"71477559","full_name":"sqreen/tor-test","owner":"sqreen","description":"Nodejs tool to check if a request comes from Tor","archived":false,"fork":false,"pushed_at":"2023-03-09T18:14:33.000Z","size":59,"stargazers_count":44,"open_issues_count":1,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-25T20:01:58.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/sqreen.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":"2016-10-20T15:34:16.000Z","updated_at":"2024-06-19T05:26:35.018Z","dependencies_parsed_at":"2024-06-19T05:26:34.629Z","dependency_job_id":"a959151a-9ef8-48cc-887c-5941a2e65571","html_url":"https://github.com/sqreen/tor-test","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.1428571428571429,"last_synced_commit":"9d7c06b96b1a3feb2a9b75dc47e4c9b96575dfc0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqreen%2Ftor-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqreen%2Ftor-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqreen%2Ftor-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqreen%2Ftor-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqreen","download_url":"https://codeload.github.com/sqreen/tor-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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-11-23T23:56:14.673Z","updated_at":"2025-10-06T18:38:44.473Z","avatar_url":"https://github.com/sqreen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tor-test [![Build Status](https://travis-ci.org/sqreen/tor-test.svg?branch=master)](https://travis-ci.org/sqreen/tor-test)\n\nThis module checks whether a specific ip address is a Tor exit node. In other words tor-test lets you know if a connection\nto your Node.js application is coming from the Tor network.\n\n[See associated blogpost](https://blog.sqreen.io/identify-tor-connections-node-js-tor-test/).\n\n## Installation\n\n```sh\n$ npm i -S tor-test\n```\nThis will install the module and save it in your `package.json` as dependency.\n\n## Usage\n\n```js\nconst TorTest = require('tor-test');\n\nTorTest.isTor('127.0.0.1', (err, isTor) =\u003e {\n\n    // isTor is false\n});\n```\n\n## API\n\n### fetch(callback):\n\nThis methods feeds the cache of the module with a list of Tor exit nodes.\nIt takes 1 parameter:\n* `callback`: a function which signature is `function (err)` where `err` is an `Error` or `null`.\n\n```js\nconst TorTest = require('tor-test');\n\nTorTest.fetch((err) =\u003e ...)\n```\n\n### isTor(addr, [force], callback):\n\nThis method is used to check if an IP address is a Tor exit node.\nIf `fetch` has not been called before, it will be called at the first call of `isTor`.\nIt takes 3 arguments:\n* `addr`: a string representing the IP address to test\n* `force`: a boolean, optional, if present and set to `true`, it will force a reload of the cached Tor exit node list.\n* `callback`: a function which signature is `function (err, result)` where:\n    * `err` is an `Error` or `null`\n    * `result` is a boolean. It will equal `true` is `addr` is the address of a Tor exit node\n    \n### refreshStoreOlderThan(days, callback):\n\nThis method set the maximum days elapsed before an automatic reload of the Tor node exit node list.\n* `days`: a number representing the maximum of days before an automatic reload of the Tor exit node node list.\n* `callback`: a function which signature is `function (err)` where `err` is an `Error` or `null`.\n\n## Cookbook\n\nA cookbook is available for this module:\n* [Log all connections from Tor](./cookbook/log.md) (framework agnostic)\n* [Update the exit nodes list daily](./cookbook/update.md)\n* [Express: exclude Tor users](./cookbook/express.md)\n* [hapi: exclude Tor users](./cookbook/hapi.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqreen%2Ftor-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqreen%2Ftor-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqreen%2Ftor-test/lists"}