Commit 9775d084 authored by Andrey Galkin's avatar Andrey Galkin

Initial module structure

parents
module.exports = {
"env": {
"es6": true,
"node": true,
commonjs: true,
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": ["off"],
"semi": ["error", "always"],
"strict": ["error", "global"],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"valid-jsdoc": ["error", { requireReturn: false } ],
"require-jsdoc": "error",
"no-template-curly-in-string": ["error"],
"curly": ["error", "multi-line"],
"no-multi-spaces": ["error"],
//"array-bracket-newline": ["error", { "multiline": true, "minItems": 3 }],
"array-bracket-spacing": ["error", "always"],
//"array-element-newline": ["error", { "multiline": true, "minItems": 3 }],
"block-spacing": ["error"],
"brace-style": ["error", "1tbs"],
"no-trailing-spaces": "error",
"no-unused-vars": [
"error",
{
"vars" : "all",
"args" : "all",
"argsIgnorePattern" : "^(as|err|_.*)$"
}
],
"no-useless-concat": "error",
"no-useless-return": "error",
"no-useless-escape": "error",
// "object-curly-newline": ["error", { "multiline": true }],
"object-curly-spacing": ["error", "always"],
//"object-property-newline": "error",
"one-var": ["error", "never"],
"padded-blocks": ["error", "never"],
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": ["for", "while", "do", "class", "if", "switch", "try", "with"] },
{ "blankLine": "always", "prev": ["for", "while", "do", "class", "if", "switch", "try", "with"], "next": "*" },
{ "blankLine": "always", "prev": "var", "next": "*" },
{ "blankLine": "any", "prev": "var", "next": "var" },
],
"space-before-blocks": "error",
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"space-in-parens": ["error", "always"],
"quote-props": ["error", "as-needed"],
"wrap-regex": "error",
},
overrides: [
{
env: {
browser: true,
},
files: [ "lib/browser*.js" ],
rules: {
strict: [ "error", "function" ],
"no-console" : ["off"],
"brace-style": ["off"],
}
},
{
env : {
mocha: true,
browser: true,
},
files: [ "test/**/*.js" ],
rules: {
"no-console" : ["off"],
"no-unused-vars": ["off"],
"require-jsdoc" : ["off"],
}
},
]
};
node_modules/
coverage/
out/
dist/
*.tgz
language: node_js
dist: trusty
node_js:
- '9'
- '8'
- '6'
before_install:
- sudo pip install futoin-cid
script:
- rm -rf node_modules
- nodeVer=$TRAVIS_NODE_VERSION nodeEnv=development cid prepare
- nodeVer=$TRAVIS_NODE_VERSION nodeEnv=development cid run test
'use strict';
var fs = require( 'fs' );
module.exports = function( grunt ) {
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
eslint: {
options: {
fix: true,
ignore: false,
},
target: [
'*.js',
'lib/**/*.js',
'test/**/*.js',
],
},
mocha_istanbul: { coverage: { src: [ 'test' ] } },
istanbul_check_coverage: {},
jsdoc2md: {
README: {
src: [ '*.js', 'lib/**/*.js' ],
dest: "README.md",
options: { template: fs.readFileSync( 'misc/README.hbs', 'utf8' ) },
},
},
replace: {
README: {
src: "README.md",
overwrite: true,
replacements: [
{
from: "$$pkg.version$$",
to: "<%= pkg.version %>",
},
],
},
},
} );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-mocha-istanbul' );
grunt.registerTask( 'check', [ 'eslint' ] );
grunt.registerTask( 'node', [ 'mocha_istanbul' ] );
grunt.registerTask( 'test', [
'check',
'node',
'doc',
] );
grunt.loadNpmTasks( 'grunt-jsdoc-to-markdown' );
grunt.loadNpmTasks( 'grunt-text-replace' );
grunt.registerTask( 'doc', [ 'jsdoc2md:README', 'replace:README' ] );
grunt.registerTask( 'default', [ 'check' ] );
};
'use strict';
/**
* @file
*
* Copyright 2017 FutoIn Project (https://futoin.org)
* Copyright 2017 Andrey Galkin <andrey@futoin.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**
* @file
*
* Copyright 2017 FutoIn Project (https://futoin.org)
* Copyright 2017 Andrey Galkin <andrey@futoin.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**
* @file
*
* Copyright 2017 FutoIn Project (https://futoin.org)
* Copyright 2017 Andrey Galkin <andrey@futoin.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**
* @file
*
* Copyright 2017 FutoIn Project (https://futoin.org)
* Copyright 2017 Andrey Galkin <andrey@futoin.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class IPSetBase {
constructor() {
// Prefix Map
this._pm = new Map();
// Sorted Prefix List
this._spl = [];
}
}
module.exports = IPSetBase;
This diff is collapsed.
[![NPM Version](https://img.shields.io/npm/v/futoin-ipset.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![NPM Downloads](https://img.shields.io/npm/dm/futoin-ipset.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![Build Status](https://travis-ci.org/futoin/core-js-ri-asyncsteps.svg)](https://travis-ci.org/futoin/core-js-ri-asyncsteps)
[![stable](https://img.shields.io/badge/stability-stable-green.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![NPM](https://nodei.co/npm/futoin-ipset.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/futoin-ipset/)
Author: [Andrey Galkin](mailto:andrey@futoin.org)
[Web Site](http://futoin.org/)
# About
In absence of anything else up-to-date, pure JS and decent for efficient processing of large
IP set matching with associative value outcome.
Key features:
* IPv4 and IPv6 support on top of [ip-address](https://www.npmjs.com/package/ip-address) module.
* Efficient prefix matching relying on JS Map implementation performance.
* Dynamic ipset manipulation.
* Associate any value
# Installation for Node.js
Command line:
```sh
$ npm install futoin-ipset --save
```
or:
```sh
$ yarn add futoin-ipset --save
```
# Browser installation
The module can be used with `webpack` or any other CommonJS packer. However, please
ensure to use ES6->ES5 transpilation for older browsers.
There is no browser use case yet though.
# API documentation
*documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown)*.
{
"name": "futoin-ipset",
"version": "0.0.1",
"vcs": "git",
"rms": "npm",
"rmsRepo": "ignored",
"plugins": {
"release": "futoin.cid.misc.releasetool"
},
"actions": {
"test": [
"@cid tool envexec node -- sh -c \"test $NODE_ENV != production\"",
"@cid tool exec grunt -- test"
],
"upgrade-deps": [
"@cid tool update",
"@cid tool exec yarn -- upgrade --latest"
]
}
}
[![NPM Version](https://img.shields.io/npm/v/futoin-ipset.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![NPM Downloads](https://img.shields.io/npm/dm/futoin-ipset.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![Build Status](https://travis-ci.org/futoin/core-js-ri-asyncsteps.svg)](https://travis-ci.org/futoin/core-js-ri-asyncsteps)
[![stable](https://img.shields.io/badge/stability-stable-green.svg?style=flat)](https://www.npmjs.com/package/futoin-ipset)
[![NPM](https://nodei.co/npm/futoin-ipset.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/futoin-ipset/)
Author: [Andrey Galkin](mailto:andrey@futoin.org)
[Web Site](http://futoin.org/)
# About
In absence of anything else up-to-date, pure JS and decent for efficient processing of large
IP set matching with associative value outcome.
Key features:
* IPv4 and IPv6 support on top of [ip-address](https://www.npmjs.com/package/ip-address) module.
* Efficient prefix matching relying on JS Map implementation performance.
* Dynamic ipset manipulation.
* Associate any value
# Installation for Node.js
Command line:
```sh
$ npm install futoin-ipset --save
```
or:
```sh
$ yarn add futoin-ipset --save
```
# Browser installation
The module can be used with `webpack` or any other CommonJS packer. However, please
ensure to use ES6->ES5 transpilation for older browsers.
There is no browser use case yet though.
# API documentation
{{>main}}
*documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown)*.
{
"name": "futoin-ipset",
"version": "0.0.1",
"description": "Pure JS large ipset matching",
"main": "index.js",
"engines": {
"node": ">=6"
},
"scripts": {
"test": "grunt test"
},
"repository": {
"type": "git",
"url": "https://github.com/futoin/core-js-ri-asyncsteps.git"
},
"keywords": [
"futoin",
"ipset",
"ipv4",
"ipv6",
"cidr",
"ip",
"blacklist",
"whitelist"
],
"author": {
"name": "Andrey Galkin",
"email": "andrey@futoin.org"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/futoin/core-js-ri-asyncsteps/issues",
"email": "support@futoin.org"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-env": "^1.6.1",
"chai": "^4.1.2",
"eslint": "^4.12.1",
"grunt": "^1.0.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-eslint": "^20.1.0",
"grunt-jsdoc-to-markdown": "^3.0.0",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-mocha-phantomjs": "^4.0.0",
"grunt-text-replace": "^0.4.0",
"grunt-webpack": "^3.0.2",
"istanbul": "^0.4.5",
"mocha": "^4.0.1",
"webpack": "^3.10.0"
},
"dependencies": {
"ip-address": "^5.8.9",
"performance-now": "^2.1.0"
},
"eslintIgnore": [
"test/**"
]
}
'use strict';
const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' );
module.exports = {
entry: {
'futoin-ipset': './lib/browser.js',
},
output: {
library: {
root: "$as",
amd: "futoin-asyncsteps",
commonjs: "futoin-asyncsteps",
},
libraryTarget: "umd",
filename: "[name].js",
path: __dirname + '/dist',
},
node : false,
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [ 'babel-preset-env' ],
plugins: [ "transform-object-assign" ],
},
},
},
],
},
plugins: [
new UglifyJsPlugin( {
sourceMap: true,
} ),
],
};
'use strict';
module.exports = {
entry: {
unittest : './test/unittest.js',
},
output: {
filename: "[name].js",
path: __dirname + '/dist',
},
node : false,
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [ 'babel-preset-env' ],
plugins: [ "transform-object-assign" ],
},
},
},
],
},
};
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment