Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipware

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipware - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.0.7
Enhancement:
- Added support for x_forwarded_for
## 0.0.6

@@ -2,0 +8,0 @@

1

defaults.json

@@ -11,2 +11,3 @@ {

"HTTP_VIA",
"X_FORWARDED_FOR",
"REMOTE_ADDR"

@@ -13,0 +14,0 @@ ],

2

package.json
{
"name": "ipware",
"version": "0.0.6",
"version": "0.0.7",
"description": "Returns the real IP address of users in Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ Node IPware

[![Build Status](https://secure.travis-ci.org/un33k/node-ipware.png?branch=master)](http://travis-ci.org/un33k/node-ipware)
[![Build Status](https://secure.travis-ci.org/un33k/node-ipware.png?branch=master)](http://travis-ci.org/un33k/node-ipware)
[![Downloads](http://img.shields.io/npm/dm/ipware.svg)](https://npmjs.org/package/ipware)

@@ -86,2 +86,3 @@

"HTTP_VIA",
"X_FORWARDED_FOR",
"REMOTE_ADDR"

@@ -88,0 +89,0 @@ ],

@@ -6,3 +6,3 @@ var get_ip = require('..')().get_ip,

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_multiple', function() {
it('test_http_x_forwarded_for_multiple', function() {
var request = {headers: {}};

@@ -19,3 +19,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '192.168.255.182, 10.0.0.0, 127.0.0.1, 198.84.193.157, 177.139.233.139';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_multiple_right_most_proxy', function() {
it('test_http_x_forwarded_for_multiple_right_most_proxy', function() {
var request = {headers: {}};

@@ -32,3 +32,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '192.168.255.182, 198.84.193.157, 10.0.0.0, 127.0.0.1, 177.139.233.139';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_multiple_bad_address', function() {
it('test_http_x_forwarded_for_multiple_bad_address', function() {
var request = {headers: {}};

@@ -45,3 +45,3 @@ request.headers.HTTP_X_FORWARDED_FOR = 'unknown, 192.168.255.182, 10.0.0.0, 127.0.0.1, 198.84.193.157, 177.139.233.139';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_singleton', function() {
it('test_http_x_forwarded_for_singleton', function() {
var request = {headers: {}};

@@ -58,3 +58,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '177.139.233.139';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_x_forwarded_for_singleton_private_address', function() {
it('test_http_x_forwarded_for_singleton_private_address', function() {
var request = {headers: {}};

@@ -71,3 +71,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '192.168.255.182';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_bad_x_forwarded_for_fallback_on_x_real_ip', function() {
it('test_bad_http_x_forwarded_for_fallback_on_x_real_ip', function() {
var request = {headers: {}};

@@ -84,3 +84,3 @@ request.headers.HTTP_X_FORWARDED_FOR = 'unknown 177.139.233.139';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_empty_x_forwarded_for_fallback_on_x_real_ip', function() {
it('test_empty_http_x_forwarded_for_fallback_on_x_real_ip', function() {
var request = {headers: {}};

@@ -97,3 +97,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_empty_x_forwarded_for_empty_x_real_ip_fallback_on_remote_addr', function() {
it('test_empty_http_x_forwarded_for_empty_x_real_ip_fallback_on_remote_addr', function() {
var request = {headers: {}};

@@ -110,3 +110,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_empty_x_forwarded_for_private_x_real_ip_fallback_on_remote_addr', function() {
it('test_empty_http_x_forwarded_for_private_x_real_ip_fallback_on_remote_addr', function() {
var request = {headers: {}};

@@ -123,3 +123,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV4: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_private_x_forward_for_ip_addr', function() {
it('test_private_http_x_forward_for_ip_addr', function() {
var request = {headers: {}};

@@ -160,3 +160,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '127.0.0.1';

describe('get_ip(): IPV4: HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_missing_x_forwarded', function() {
it('test_missing_http_x_forwarded', function() {
var request = {headers: {}};

@@ -172,3 +172,3 @@ request.headers.HTTP_X_REAL_IP = '177.139.233.132';

describe('get_ip(): IPV4: REMOTE_ADDR', function() {
it('test_missing_x_forwarded_missing_real_ip', function() {
it('test_missing_http_x_forwarded_missing_real_ip', function() {
var request = {headers: {}};

@@ -205,2 +205,30 @@ request.headers.REMOTE_ADDR = '177.139.233.133';

describe('get_ip(): IPV4: X_FORWARDED_FOR', function() {
it('test_x_forwarded_for', function() {
var request = {headers: {}};
request.headers.HTTP_X_FORWARDED_FOR = '';
request.headers.X_FORWARDED_FOR = '177.139.233.132';
request.headers.REMOTE_ADDR = '177.139.233.100';
get_ip(request);
assert.equal(request.clientIp, '177.139.233.132');
assert.equal(request.clientIpRoutable, true);
});
});
describe('get_ip(): IPV4: X_FORWARDED_FOR and HTTP_X_FORWARDED_FOR', function() {
it('test_http_x_forwarded_for_precedence', function() {
var request = {headers: {}};
request.headers.HTTP_X_FORWARDED_FOR = '80.10.1.10';
request.headers.X_FORWARDED_FOR = '177.139.233.132';
request.headers.REMOTE_ADDR = '';
get_ip(request);
assert.equal(request.clientIp, '80.10.1.10');
assert.equal(request.clientIpRoutable, true);
});
});
describe('get_ip(): IPV4: Test 1.0.0.0/8 blocks', function() {

@@ -207,0 +235,0 @@ it('test_1_0_0_0_block', function() {

@@ -6,3 +6,3 @@ var get_ip = require('..')().get_ip,

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_multiple', function() {
it('test_http_x_forwarded_for_multiple', function() {
var request = {headers: {}};

@@ -18,4 +18,15 @@ request.headers.HTTP_X_FORWARDED_FOR = '3ffe:1900:4545:3:200:f8ff:fe21:67cf, 74dc::02ba';

describe('get_ip(): IPV6: X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_single', function() {
var request = {headers: {}};
request.headers.X_FORWARDED_FOR = '3ffe:1900:4545:3:200:f8ff:fe21:67cf';
request.headers.REMOTE_ADDR = '74dc::02ba';
get_ip(request);
assert.equal(request.clientIp, '3ffe:1900:4545:3:200:f8ff:fe21:67cf');
assert.equal(request.clientIpRoutable, true);
});
});
describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_multiple_bad_address', function() {
it('test_http_x_forwarded_for_multiple_bad_address', function() {
var request = {headers: {}};

@@ -32,3 +43,3 @@ request.headers.HTTP_X_FORWARDED_FOR = 'unknown, ::1/128, 74dc::02ba';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR', function() {
it('test_x_forwarded_for_singleton', function() {
it('test_http_x_forwarded_for_singleton', function() {
var request = {headers: {}};

@@ -45,3 +56,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '74dc::02ba';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_x_forwarded_for_singleton_private_address', function() {
it('test_http_x_forwarded_for_singleton_private_address', function() {
var request = {headers: {}};

@@ -58,3 +69,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '::1/128';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_bad_x_forwarded_for_fallback_on_x_real_ip', function() {
it('test_bad_http_x_forwarded_for_fallback_on_x_real_ip', function() {
var request = {headers: {}};

@@ -71,3 +82,3 @@ request.headers.HTTP_X_FORWARDED_FOR = 'unknown ::1/128';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP', function() {
it('test_empty_x_forwarded_for_fallback_on_x_real_ip', function() {
it('test_empty_http_x_forwarded_for_fallback_on_x_real_ip', function() {
var request = {headers: {}};

@@ -84,3 +95,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_empty_x_forwarded_for_empty_x_real_ip_fallback_on_remote_addr', function() {
it('test_empty_http_x_forwarded_for_empty_x_real_ip_fallback_on_remote_addr', function() {
var request = {headers: {}};

@@ -97,3 +108,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_empty_x_forwarded_for_private_x_real_ip_fallback_on_remote_addr', function() {
it('test_empty_http_x_forwarded_for_private_x_real_ip_fallback_on_remote_addr', function() {
var request = {headers: {}};

@@ -110,3 +121,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '';

describe('get_ip(): IPV6: HTTP_X_FORWARDED_FOR & HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_private_x_forward_for_ip_addr', function() {
it('test_private_http_x_forward_for_ip_addr', function() {
var request = {headers: {}};

@@ -147,3 +158,3 @@ request.headers.HTTP_X_FORWARDED_FOR = '::1/128';

describe('get_ip(): IPV6: HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_missing_x_forwarded', function() {
it('test_missing_http_x_forwarded', function() {
var request = {headers: {}};

@@ -159,3 +170,3 @@ request.headers.HTTP_X_REAL_IP = '74dc::02ba';

describe('get_ip(): IPV6: REMOTE_ADDR', function() {
it('test_missing_x_forwarded_missing_real_ip', function() {
it('test_missing_http_x_forwarded_missing_real_ip', function() {
var request = {headers: {}};

@@ -170,3 +181,3 @@ request.headers.REMOTE_ADDR = '74dc::02ba';

describe('get_ip(): IPV6: HTTP_X_REAL_IP & REMOTE_ADDR', function() {
it('test_missing_x_forwarded_missing_real_ip_mix_case', function() {
it('test_missing_http_x_forwarded_missing_real_ip_mix_case', function() {
var request = {headers: {}};

@@ -213,2 +224,3 @@ request.headers.REMOTE_ADDR = '74dC::02bA';

describe('get_ip(): IPV6: http_x_real_ip', function() {

@@ -215,0 +227,0 @@ it('test_fallback_on_request.connection.remoteAddress.private', function() {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc