0.3.0 • Published 8 years ago

cloudflare-ips v0.3.0

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

CloudFlare IP Ranges

build status npm version npm downloads

The list of CloudFlare IPs (IP ranges) to be used in the trust proxy configurations.

How to Use

$ npm install cloudflare-ips    # or, `yarn add cloudflare-ips`
const express = require('express');
const cloudflareIPs = require('cloudflare-ips');

const app = express();

cloudflareIPs(
  ips => app.set('trust proxy', ['loopback', ...ips]),
  err => console.error(err.stack),
);

cloudflareIPs((err, ips) => {
  app.set('trust proxy', ['loopback', ...ips]);
});

app.listen(8080);

API

cloudFlareIPs(onUpdate, onError, options)

  • onUpdate: (ips: string[]) => void — a callback function accepting the list of IPs
  • onError: (err: Error) => void — a callback that is triggered on error (optional)
  • options: { inteval: number } — allows to tweak the default settings (optional)

Related Projects

License

Copyright © 2017-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file.


Made with ♥ by Konstantin Tarkus (@koistya, blog)