mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-04-26 02:12:29 +00:00
fix: allow internal
libp2p should eventually handle listen versus announce addresses, this helps with ip6 support in the interim License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
parent
5f8571efb0
commit
537ebee0b4
@ -102,7 +102,7 @@ module.exports = (handler) => {
|
|||||||
const netInterfaces = os.networkInterfaces()
|
const netInterfaces = os.networkInterfaces()
|
||||||
Object.keys(netInterfaces).forEach((niKey) => {
|
Object.keys(netInterfaces).forEach((niKey) => {
|
||||||
netInterfaces[niKey].forEach((ni) => {
|
netInterfaces[niKey].forEach((ni) => {
|
||||||
if (ni.family === 'IPv4' && !ni.internal) {
|
if (ni.family === 'IPv4') {
|
||||||
multiaddrs.push(
|
multiaddrs.push(
|
||||||
multiaddr(listeningAddr.toString().replace('0.0.0.0', ni.address))
|
multiaddr(listeningAddr.toString().replace('0.0.0.0', ni.address))
|
||||||
)
|
)
|
||||||
@ -122,7 +122,7 @@ module.exports = (handler) => {
|
|||||||
netInterfaces[niKey].forEach((ni) => {
|
netInterfaces[niKey].forEach((ni) => {
|
||||||
if (ni.family === address.family) {
|
if (ni.family === address.family) {
|
||||||
const maOpts = listeningAddr.toOptions()
|
const maOpts = listeningAddr.toOptions()
|
||||||
if (maOpts.host === '::' && !ni.internal) {
|
if (maOpts.host === '::') {
|
||||||
maOpts.family = address.family
|
maOpts.family = address.family
|
||||||
maOpts.address = ni.address
|
maOpts.address = ni.address
|
||||||
multiaddrs.push(
|
multiaddrs.push(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user