Socket
Socket
Sign inDemoInstall

futoin-ipset

Package Overview
Dependencies
4
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

3

CHANGELOG.txt
=== 1.2.0 (2018-03-02) ===
NEW: support for IPv4-mapped IPv6 addresses
=== 1.1.0 (2018-02-17) ===

@@ -3,0 +6,0 @@ FIXED: to work with frozen Object.prototype

@@ -25,2 +25,4 @@ 'use strict';

const IPV4INV6_PREFIX = 96;
/**

@@ -43,5 +45,10 @@ * Universal IPv4/IPv6 wrapper

try {
this._v4.add( addr, value );
const v4_addr = this._v4.add( addr, value );
this._v6.add( this._4to6( v4_addr ), value );
} catch ( _ ) {
this._v6.add( addr, value );
const v6_addr = this._v6.add( addr, value );
if ( v6_addr.v4 ) {
this._v4.add( this._6to4( v6_addr ), value );
}
}

@@ -56,5 +63,10 @@ }

try {
this._v4.remove( addr );
const v4_addr = this._v4.remove( addr );
this._v6.remove( this._4to6( v4_addr ) );
} catch ( _ ) {
this._v6.remove( addr );
const v6_addr = this._v6.remove( addr );
if ( v6_addr.v4 ) {
this._v4.remove( this._6to4( v6_addr ) );
}
}

@@ -88,4 +100,16 @@ }

}
_4to6( v4_addr ) {
const mask = v4_addr.subnetMask + IPV4INV6_PREFIX;
return `::ffff:${v4_addr.toGroup6()}/${mask}`;
}
_6to4( v6_addr ) {
const base = v6_addr.to4().correctForm();
const mask = v6_addr.subnetMask - IPV4INV6_PREFIX;
const safe_mask = mask < 0 ? 0 : mask;
return `${base}/${safe_mask}`;
}
}
module.exports = IPSet;

@@ -44,2 +44,3 @@ 'use strict';

* @param {any} value - any value to associate
* @returns {object} converted IP address
*/

@@ -62,2 +63,4 @@ add( addr, value ) {

prefix_map.set( prefix, value );
return addr;
}

@@ -68,2 +71,3 @@

* @param {string|object} addr - instance implementing *ip-address* interface or string representation
* @returns {object} converted IP address
*/

@@ -87,2 +91,4 @@ remove( addr ) {

}
return addr;
}

@@ -89,0 +95,0 @@

8

package.json
{
"name": "futoin-ipset",
"version": "1.1.0",
"version": "1.2.0",
"description": "Pure JS large IP set matching",

@@ -44,3 +44,3 @@ "main": "index.js",

"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-loader": "^7.1.3",
"babel-plugin-transform-object-assign": "^6.22.0",

@@ -50,3 +50,3 @@ "babel-polyfill": "^6.26.0",

"chai": "^4.1.2",
"eslint": "^4.18.0",
"eslint": "^4.18.1",
"grunt": "^1.0.2",

@@ -62,3 +62,3 @@ "grunt-contrib-connect": "^1.0.2",

"mocha": "^5.0.1",
"webpack": "^3.11.0"
"webpack": "^4.0.1"
},

@@ -65,0 +65,0 @@ "dependencies": {

@@ -211,4 +211,4 @@

* [new IPSetBase(address_impl)](#new_IPSetBase_new)
* [.add(addr, value)](#IPSetBase+add)
* [.remove(addr)](#IPSetBase+remove)
* [.add(addr, value)](#IPSetBase+add) ⇒ <code>object</code>
* [.remove(addr)](#IPSetBase+remove) ⇒ <code>object</code>
* [.match(addr)](#IPSetBase+match) ⇒ <code>any</code>

@@ -229,6 +229,7 @@ * [.convertAddress(addr)](#IPSetBase+convertAddress) ⇒ <code>object</code>

### ipSetBase.add(addr, value)
### ipSetBase.add(addr, value) ⇒ <code>object</code>
Add address to IP set
**Kind**: instance method of [<code>IPSetBase</code>](#IPSetBase)
**Returns**: <code>object</code> - converted IP address

@@ -242,6 +243,7 @@ | Param | Type | Description |

### ipSetBase.remove(addr)
### ipSetBase.remove(addr) ⇒ <code>object</code>
Remove address from IP set
**Kind**: instance method of [<code>IPSetBase</code>](#IPSetBase)
**Returns**: <code>object</code> - converted IP address

@@ -248,0 +250,0 @@ | Param | Type | Description |

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc