@tinyhttp/ip-filter

npm (scoped) npm

IP Filtering middleware to send 403 on bad IPs.

Install

pnpm i @tinyhttp/ip-filter

API

import { ipFilter } from '@tinyhttp/ip-filter'

ipFilter(options)

Returns the IP filter middleware.

Options

Example

import { App } from '@tinyhttp/app'
import { ipFilter } from '@tinyhttp/ip-filter'

const app = new App()

app.use(ipFilter({ forbidden: 'Get the f*ck out of my server!', filter: [`*.example.com`], strict: true }))

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(3000)

License

MIT © v1rtl

Install

pnpm i @tinyhttp/ip-filter

Version

0.0.14

Source

packages/ip-filter