Giter VIP home page Giter VIP logo

tor-test's Introduction

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

refreshStoreOlderThan(days, callback):

This method set the maximum days elapsed before an automatic reload of the Tor node exit node list.

  • days: a number representing the maximum of days before an automatic reload of the Tor exit node node list.
  • callback: a function which signature is function (err) where err is an Error or null.

Cookbook

A cookbook is available for this module:

tor-test's People

Contributors

vdeturckheim avatar vouill avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.