Socket
Socket
Sign inDemoInstall

tor-test

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tor-test

Nodejs tool to check if a request comes from Tor


Version published
Weekly downloads
45
decreased by-21.05%
Maintainers
1
Install size
145 kB
Created
Weekly downloads
 

Readme

Source

tor-test Build Status

This module checks whether a specific ip address is a Tor exit node. In other words tor-test lets you know if a connection to your Node.js application is coming from the Tor network.

See associated blogpost.

Installation

$ npm i -S tor-test

This will install the module and save it in your package.json as dependency.

Usage

const TorTest = require('tor-test');

TorTest.isTor('127.0.0.1', (err, isTor) => {

    // isTor is false
});

API

fetch(callback):

This methods feeds the cache of the module with a list of Tor exit nodes. It takes 1 parameter:

  • callback: a function which signature is function (err) where err is an Error or null.
const TorTest = require('tor-test');

TorTest.fetch((err) => ...)

isTor(addr, [force], callback):

This method is used to check if an IP address is a Tor exit node. If fetch has not been called before, it will be called at the first call of isTor. It takes 3 arguments:

  • addr: a string representing the IP address to test
  • force: a boolean, optional, if present and set to true, it will force a reload of the cached Tor exit node list.
  • callback: a function which signature is function (err, result) where:
    • err is an Error or null
    • result is a boolean. It will equal true is addr is the address of a Tor exit node

Cookbook

A cookbook is available for this module:

Keywords

FAQs

Last updated on 15 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc