in-gfw
Identify if current location is located in mainland China.
Install
npm install in-gfw
Usage
const inGFW = ;; // `true` for located in mainland ChinainGFW; // `true` for system located in mainland ChinainGFW; // `true` for network located in mainland China
API
;inGFW; // Synchronous version of `inGFW()`
Get result by inGFW.os()
and fallback to inGFW.net()
inGFW;inGFW; // 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
orPRC
.
inGFW;inGFW; // Synchronous version of `inGFW.net()`
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.