libp2p-tcp
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -0,1 +1,11 @@ | ||
<a name="0.12.1"></a> | ||
## [0.12.1](https://github.com/libp2p/js-libp2p-tcp/compare/v0.12.0...v0.12.1) (2018-07-31) | ||
### Bug Fixes | ||
* invalid ip address and daemon can be crashed by remote user ([4b04b17](https://github.com/libp2p/js-libp2p-tcp/commit/4b04b17)) | ||
<a name="0.12.0"></a> | ||
@@ -2,0 +12,0 @@ # [0.12.0](https://github.com/libp2p/js-libp2p-tcp/compare/v0.11.6...v0.12.0) (2018-04-05) |
{ | ||
"name": "libp2p-tcp", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces", | ||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"lint": "aegir lint", | ||
"test": "aegir test -t node", | ||
"test": "aegir test -t node -f test/**/*.js", | ||
"release": "aegir release -t node --no-build", | ||
@@ -26,3 +27,2 @@ "release-minor": "aegir release -t node --type minor --no-build", | ||
], | ||
"author": "David Dias <daviddias@ipfs.io>", | ||
"license": "MIT", | ||
@@ -38,3 +38,3 @@ "bugs": { | ||
"devDependencies": { | ||
"aegir": "^13.0.6", | ||
"aegir": "^15.1.0", | ||
"chai": "^4.1.2", | ||
@@ -44,3 +44,2 @@ "dirty-chai": "^2.0.1", | ||
"lodash.isfunction": "^3.0.9", | ||
"pre-commit": "^1.2.2", | ||
"pull-stream": "^3.6.7" | ||
@@ -69,2 +68,4 @@ }, | ||
"Greenkeeper <support@greenkeeper.io>", | ||
"Jacob Heun <jacobheun@gmail.com>", | ||
"Jacob Heun <jake@andyet.net>", | ||
"João Antunes <j.goncalo.antunes@gmail.com>", | ||
@@ -74,4 +75,5 @@ "Pedro Teixeira <i@pgte.me>", | ||
"Richard Littauer <richard.littauer@gmail.com>", | ||
"Stephen Whitmore <stephen.whitmore@gmail.com>" | ||
"Stephen Whitmore <stephen.whitmore@gmail.com>", | ||
"TomCoded <tomtinkerer@gmail.com>" | ||
] | ||
} |
@@ -18,2 +18,6 @@ # js-libp2p-tcp | ||
## Lead Maintainer | ||
[Jacob Heun](https://github.com/jacobheun) | ||
## Table of Contents | ||
@@ -20,0 +24,0 @@ |
@@ -5,2 +5,4 @@ 'use strict' | ||
const Address6 = require('ip-address').Address6 | ||
const debug = require('debug') | ||
const log = debug('libp2p:tcp:get-multiaddr') | ||
@@ -10,21 +12,24 @@ module.exports = (socket) => { | ||
if (socket.remoteFamily === 'IPv6') { | ||
const addr = new Address6(socket.remoteAddress) | ||
try { | ||
if (socket.remoteFamily === 'IPv6') { | ||
const addr = new Address6(socket.remoteAddress) | ||
if (addr.v4) { | ||
const ip4 = addr.to4().correctForm() | ||
ma = multiaddr('/ip4/' + ip4 + | ||
'/tcp/' + socket.remotePort | ||
) | ||
if (addr.v4) { | ||
const ip4 = addr.to4().correctForm() | ||
ma = multiaddr('/ip4/' + ip4 + | ||
'/tcp/' + socket.remotePort | ||
) | ||
} else { | ||
ma = multiaddr('/ip6/' + socket.remoteAddress + | ||
'/tcp/' + socket.remotePort | ||
) | ||
} | ||
} else { | ||
ma = multiaddr('/ip6/' + socket.remoteAddress + | ||
'/tcp/' + socket.remotePort | ||
) | ||
ma = multiaddr('/ip4/' + socket.remoteAddress + | ||
'/tcp/' + socket.remotePort) | ||
} | ||
} else { | ||
ma = multiaddr('/ip4/' + socket.remoteAddress + | ||
'/tcp/' + socket.remotePort) | ||
} catch (err) { | ||
log(err) | ||
} | ||
return ma | ||
} |
@@ -28,2 +28,11 @@ 'use strict' | ||
const addr = getMultiaddr(socket) | ||
if (!addr) { | ||
if (socket.remoteAddress === undefined) { | ||
log('connection closed before p2p connection made') | ||
} else { | ||
log('error interpreting incoming p2p connection') | ||
} | ||
return | ||
} | ||
log('new connection', addr.toString()) | ||
@@ -30,0 +39,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
33344
6
216
117
3