# in-gfw

> Identify current location is located in mainland China.

Latest version **1.2.0** (published 2018-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install in-gfw
pnpm add in-gfw
yarn add in-gfw
bun add in-gfw
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-07-04 |
| First published | 2018-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | gucong3000 |
| Maintainers | gucong |
| Keywords | OS, system, location, geo, PRC, mainland, China, gfw, Great, Firewall |

## Links

- npm: https://www.npmjs.com/package/in-gfw
- Repository: https://github.com/gucong3000/in-gfw
- Homepage: https://github.com/gucong3000/in-gfw#readme
- Issues: https://github.com/gucong3000/in-gfw/issues
- npm.io page: https://npm.io/package/in-gfw

## Dependencies (3)

- [mem](https://npm.io/package/mem.md) ^3.0.1
- [glob](https://npm.io/package/glob.md) ^7.1.2
- [is-wsl](https://npm.io/package/is-wsl.md) ^1.1.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2018-07-04
- 1.1.2 — 2018-06-07
- 1.1.1 — 2018-05-08
- 1.1.0 — 2018-05-02
- 1.0.0 — 2018-04-02

## README

in-gfw
=====
[![NPM version](https://img.shields.io/npm/v/in-gfw.svg?style=flat-square)](https://www.npmjs.com/package/in-gfw)
[![Travis](https://img.shields.io/travis/gucong3000/in-gfw.svg?&label=Linux)](https://travis-ci.org/gucong3000/in-gfw)
[![AppVeyor](https://img.shields.io/appveyor/ci/gucong3000/in-gfw.svg?&label=Windows)](https://ci.appveyor.com/project/gucong3000/in-gfw)
[![Codecov](https://img.shields.io/codecov/c/github/gucong3000/in-gfw.svg)](https://codecov.io/gh/gucong3000/in-gfw)
[![David](https://img.shields.io/david/gucong3000/in-gfw.svg)](https://david-dm.org/gucong3000/in-gfw)

Identify if current location is located in mainland China.

## Install

```bash
npm install in-gfw
```

## Usage

```js
const inGFW = require("in-gfw");
inGFW().then(console.log);	// `true` for located in mainland China
inGFW.os().then(console.log);	// `true` for system located in mainland China
inGFW.net().then(console.log);	// `true` for network located in mainland China
```

## API

```js
inGFW(blockedHost, cnHost);
inGFW.sync(blockedHost, cnHost);	// Synchronous version of `inGFW()`
```
Get result by `inGFW.os()` and fallback to `inGFW.net()`

```js
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](https://en.wikibooks.org/wiki/Puredyne/Date_and_Timezone) is set to `Beijing`, `Chongqing`, `Shanghai`, `Urumqi` or `PRC`.

```js
inGFW.net(blockedHost, cnHost);
inGFW.netSync(blockedHost, cnHost);	// 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.

---
_Source: https://npm.io/package/in-gfw · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
