diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cdbd0..714c6c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to this project will be documented in this file. +## 2.1.0 - 2017-02-21 + +### Fixed +- IP order when Received header has multiple IPs. + ## 2.0.2 - 2016-12-09 ### Added diff --git a/lib/api.js b/lib/api.js index 0f6ba87..eb221e3 100644 --- a/lib/api.js +++ b/lib/api.js @@ -77,7 +77,7 @@ module.exports = { }); //maybe multiple IPs in one Received: line - _.each(received_ips, function(ip){ + _.eachRight(received_ips, function(ip){ var firstchar = line.substring(line.indexOf(ip)-1).substring(0,1); var lastchar = line.substring(line.indexOf(ip)+ip.length).substring(0,1); @@ -129,7 +129,7 @@ module.exports = { }); //maybe multiple IPs in one Received: line - _.each(received_ips, function(ip){ + _.eachRight(received_ips, function(ip){ var firstchar = line.substring(line.indexOf(ip)-1).substring(0,1); var lastchar = line.substring(line.indexOf(ip)+ip.length).substring(0,1); diff --git a/package.json b/package.json index c2ed9f9..fccee74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mailhops", - "version": "2.0.6", + "version": "2.1.0", "description": "A nodejs module for interacting with the MailHops API.", "main": "main.js", "scripts": { diff --git a/test/main.js b/test/main.js index 080735b..9c45b6d 100644 --- a/test/main.js +++ b/test/main.js @@ -92,10 +92,10 @@ describe("main", function(){ it('should find 9 Received IPs', function(done){ assert.deepEqual(ips,['130.235.227.36', - '130.235.56.196', '130.236.48.25', - '130.235.59.236', '130.235.56.196', + '130.235.56.196', + '130.235.59.236', '127.0.0.1', '54.157.138.253', '198.21.5.108',