Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

in-gfw

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

in-gfw

Identify current location is located in mainland China.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43K
increased by1.92%
Maintainers
1
Weekly downloads
 
Created
Source

in-gfw

NPM version Travis AppVeyor Codecov David

Identify if current location is located in mainland China.

Install

npm install in-gfw

Usage

const inGFW = require("in-gfw");
inGFW.os().then(console.log);	// `true` for system located in mainland China
const inGFW = require("in-gfw");
inGFW.net().then(console.log);	// `true` for network located in mainland China

API

inGFW.os();
inGFW.osSync();	// Synchronous version of `inGFW.os()`
  • Windows: Check if current location settings is PRC.

    Control Panel: Regional and language -> Location

  • POSIX systems: Check if timezone is set to Beijing, Chongqing, Shanghai, Urumqi or PRC.
inGFW.net(blockedHost, cnHost);

Based on the speed of network access to identify if current location is located in mainland China.

  • blockedHost

    Type: string|URL

    Default: "www.npmjs.com"

    host for speed test that blocked by GFW

  • cnHost

    Type: string|URL

    Default: "npm.taobao.org"

    host for speed test that mirrored in mainland China.

Keywords

FAQs

Package last updated on 02 May 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc