dns-filter
A small utility library to test whether requests try to access predefined IPs
WARNING
This project is not an officially maintained Algolia project.
This repository should not be used for any production project.
Bug reports and feature requests will most likely be ignored.
Usage
const { validateURL, NetworkError, PRIVATE_IP_PREFIXES } = require('@algolia/dns-filter');
const restricted = process.env.NODE_ENV === 'development'
? []
: PRIVATE_IP_PREFIXES;
const url = 'http://localhost/admin';
try {
await validateURL({
url,
ipPrefixes: restricted,
context: { some: 'metadata' },
});
}
catch (err) {
log.error(err);
throw new NetworkError();
}
Contributing
To release this package, wait for semantic-release to finish, then:
- Make sure you're logged in with
npm login
- Run:
yarn build
yarn publish