This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pull): migration to pull-streams
- Loading branch information
1 parent
caa8d6d
commit 5e89a26
Showing
7 changed files
with
348 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
const multiaddr = require('multiaddr') | ||
const Address6 = require('ip-address').Address6 | ||
|
||
module.exports = (socket) => { | ||
var mh | ||
|
||
if (socket.remoteFamily === 'IPv6') { | ||
var addr = new Address6(socket.remoteAddress) | ||
if (addr.v4) { | ||
var ip4 = addr.to4().correctForm() | ||
mh = multiaddr('/ip4/' + ip4 + '/tcp/' + socket.remotePort) | ||
} else { | ||
mh = multiaddr('/ip6/' + socket.remoteAddress + '/tcp/' + socket.remotePort) | ||
} | ||
} else { | ||
mh = multiaddr('/ip4/' + socket.remoteAddress + '/tcp/' + socket.remotePort) | ||
} | ||
|
||
return mh | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.