is-duckduck
1.0.0 • Public • Published is-duckduck
Verify that a request is from DuckDuckBot, the Web crawler for DuckDuckGo
This library implements DuckDuckGo's own verification steps outlined here.
Install
npm install --save is-duckduck
Example
const isDuckDuck = require('is-duckduck')
let ip = '72.94.249.34'
isDuckDuck(ip).then((outcome) => {
if (outcome) {
}
}).catch(console.error)
Example with express
app.enable('trust proxy')
app.use((req, res, next) => {
let ip = req.ip || req.connection.remoteAddress
isDuckDuck(ip).then(outcome => {
if (outcome) {
res.status(404).text('Nothing to scan')
} else {
next()
}
})
})
Tests
npm test
License
MIT
Author
Rocco Musolino @roccomuso
Package Sidebar
Install
Weekly Downloads