simple-vpn-detector
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Simple VPN detector

License: ISC

Detects difference between browser and IP timezones and make a decision based on this difference.

Usage

  1. Register on https://ipgeolocation.io/
  2. Install package: npm i simple-vpn-detector or yarn add simple-vpn-detector
  3. Get an answer!

Examples

Browser

/**
 * This file is the entrypoint of browser builds.
 * The code executes when loaded in a browser.
 */
import { isVPNDetected } from './main'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).isVPNDetected = isVPNDetected  // instead of casting window to any, you can extend the Window interface: https://stackoverflow.com/a/43513740/5433572

console.log('Method "foo" was added to the window object. You can try it yourself by just entering "await foo()"');

(async () => {
  const vpnDetectionStatus = await isVPNDetected('')
  console.log(`VPN Detection status: ${vpnDetectionStatus}`);
})()

Cli

#!/usr/bin/env node
import { isVPNDetected } from './main'

const apiKey: string = process.env.IP_GEOLOCATION_API_KEY || '';

isVPNDetected(apiKey)

Contribution

Feel free to create pull-requests

Dependencies (0)

    Dev Dependencies (12)

    Package Sidebar

    Install

    npm i simple-vpn-detector

    Weekly Downloads

    3

    Version

    0.0.1

    License

    ISC

    Unpacked Size

    14.8 kB

    Total Files

    25

    Last publish

    Collaborators

    • jfkz