fiftyone.ipintelligence.onpremise
v4.5.102
Published
IP intelligence on-premise services for the 51Degrees Pipeline API
Readme
Node IP Intelligence On-Premise
Introduction
This project contains 51Degrees IP Intelligence engines that can be used with the Pipeline API.
The Pipeline is a generic web request intelligence and data processing solution with the ability to add a range of 51Degrees and/or custom plug ins (Engines)
This package - fiftyone.ipintelligence.onpremise
This package definitions for the on-premise IP intelligence engine. The on-premise engine requires a data file to be supplied. A free 'Lite' data file can be downloaded with the scripts in the data repository, which is the cxx/data submodule of this repository.
The on-premise engine performs processing using a native library which is built from the C/C++ code in the 51degrees-cxx repository. Binaries are included with the published NPM package for a set of supported platforms and Node versions. If your platform or Node version is not supported then you can build the native module yourself, see 'Building the native module' below.
It can be used like this:
const IpIntelligenceOnPremisePipelineBuilder =
require('fiftyone.ipintelligence.onpremise').IpIntelligenceOnPremisePipelineBuilder;
const pipeline = new IpIntelligenceOnPremisePipelineBuilder({
performanceProfile: 'MaxPerformance',
dataFile: '51Degrees-LiteV41.ipi',
autoUpdate: false
}).build();
const flowData = pipeline.createFlowData();
flowData.evidence.add('query.client-ip', '8.8.8.8');
flowData.process().then(function () {
console.log(flowData.ip.registeredname.value);
});Installation
To install, use NPM call:
npm install fiftyone.ipintelligence.onpremiseBuilding the native module
The native module is built from the 51degrees-cxx code which is included at the root of this repository as a git submodule. To build it locally you need:
- Node.js and npm
- node-gyp (
npm install -g node-gyp) - A C/C++ tool chain. For example, MSVC build tools on Windows or g++ and make on Linux.
When working inside this repository, run node ensure-native-module.js from the repository
root to perform all of the following steps automatically. The script works on Windows, Linux
(including WSL) and MacOS. The manual steps from this directory are:
- Ensure the
cxxsubmodule at the root of the repository is checked out, including its own submodules. - Copy
binding.51dtobinding.gyp. - Run
node-gyp configureandnode-gyp build. - Copy the resulting
build/Release/FiftyOneIpIntelligenceIpiV41.nodetobuild/FiftyOneIpIntelligenceIpiV41-[platform]-[arch]-[node major version].node, where [arch] is the value ofprocess.archand [node major version] is the major version of the Node.js runtime the module was built with.
Process for rebuilding SWIG interfaces following an update to the IP intelligence cxx code (This is only intended to be run by 51Degrees developers internally):
- Ensure Swig is installed.
- Use the 51Degrees fork of Swig, built from source from the
node-24-holder-thisbranch of https://github.com/51Degrees/swig. The fork emitsThis()in place of theFunctionCallbackInfo::Holder()V8 API removed in the V8 shipped with recent Node versions. - All native modules loaded into one Node process must be generated by the same Swig version, so regenerate and release this package and fiftyone.devicedetection.onpremise together.
- Use the 51Degrees fork of Swig, built from source from the
- Run the following command in this directory:
swig -c++ -javascript -node ipi_node.iFind out more
- IP Intelligence
- IP Intelligence documentation
- Getting started
- Pricing
- https://github.com/51Degrees/51degrees-node
- https://github.com/51Degrees/51degrees-cxx
