# ip-range-middleware

> **without dependencies**

Latest version **0.0.2** (published 2019-03-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install ip-range-middleware
pnpm add ip-range-middleware
yarn add ip-range-middleware
bun add ip-range-middleware
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-03-06 |
| First published | 2019-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | spddl |
| Maintainers | spddl |
| Keywords | expressjs, middleware, ip, range |

## Links

- npm: https://www.npmjs.com/package/ip-range-middleware
- npm.io page: https://npm.io/package/ip-range-middleware

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-03-06
- 0.0.1 — 2019-03-01

## README

# Expressjs Middleware Block or Allow IP Range

**without dependencies**

## [how to use middleware in expressjs](http://expressjs.com/en/guide/writing-middleware.html)

## Getting Started

```js
const IPRange = require('ip-range-middleware')
```

## Usage


Allow only 127.0.0.1

```js
app.use(IPRange([
  [127], [0], [0], [1]
]))
```


Allow only the range from 192.168.178.1 to 192.168.178.128

```js
app.use(IPRange([
  [192], [168], [178], [1, 128]
]))
```


Allow only two addresses

```js
app.use(IPRange([
  [[192], [168], [178], [2]],
  [[127], [0], [0], [1]]
]))
```


Allow only ::1

```js
app.use(IPRange([], { allow: ['::1'] }))
```

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