Name: ip-reputation-js-client
Owner: Mozilla Services
Description: A node JS client to the tigerblood IP reputation service
Created: 2016-11-04 15:39:04.0
Updated: 2017-10-15 12:32:51.0
Pushed: 2017-09-27 15:42:00.0
Homepage: null
Size: 94
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Client library to send IP reputations to the tigerblood service.
Usage:
Create a client:
t IPReputationClient = require('ip-reputation-service-client-js')
t client = new IPReputationClient({
serviceUrl: 'http://<tigerblood service host without trailing slash>',
id: '<a hawk ID>',
key: '<a hawk key>',
timeout: <number in ms>
Get the reputation for an IP:
nt.get('127.0.0.1').then(function (response) {
if (response && response.statusCode === 404) {
console.log('No reputation found for 127.0.0.1');
} else {
console.log('127.0.0.1 has reputation: ', response.body.Reputation);
}
Set the reputation for an IP:
nt.add('127.0.0.1', 20).then(function (response) {
console.log('Added reputation of 20 for 127.0.0.1');
Update the reputation for an IP:
nt.update('127.0.0.1', 79).then(function (response) {
console.log('Set reputation for 127.0.0.1 to 79.');
Remove an IP:
nt.remove('127.0.0.1').then(function (response) {
console.log('Removed reputation for 127.0.0.1.');
Send a violation for an IP:
nt.sendViolation('127.0.0.1', 'exceeded-password-reset-failure-rate-limit').then(function (response) {
console.log('Upserted reputation for 127.0.0.1.');
config.yml
in project root:entials:
ot: toor
docker run --name postgres -p 127.0.0.1:5432:5432 -d postgres-ip4r
)npm install
scripts/setup-test-db.sh
CGO_ENABLED=0 go build --ldflags '-extldflags "-static"' ./cmd/tigerblood/ && TIGERBLOOD_DSN="user=tigerblood dbname=tigerblood sslmode=disable" ./tigerblood
npm test
to test the client against the tigerblood serverscripts/cleanup-test-db.sh