Comments (5)
It appears this is an old issue, but I am still getting this when using the js-libp2p-mdns discovery module. It seems peers advertise the loopback address, which causes any listening peers to connect to themselves (while believing that they have successfully connected to the remote peer).
I am not seeing the js-libp2p-secio handshake reject this, in fact, they connection establishes an encrypted channel and mux on both ends and raises two 'peer:connect' events to my application. Is there a workaround for this that would prevent any dials on addresses that are obviously myself?
from js-libp2p.
Sure @dryajov, thank you for your quick response! I have pushed a small demo of this bug here.
This demo setups a simple libp2p bundle with TCP transport, mDNS discovery, and SECIO. It attempts to dial any discovered peers. When run from two hosts on the same local network I get the following output:
This Peer ID: QmbQvNDBqvyDEP3LUmCNJYv8bLyxA2BP8bSYYRGVKr2Avv
Listening on addresses:
[ '/ip4/127.0.0.1/tcp/4043/ipfs/QmbQvNDBqvyDEP3LUmCNJYv8bLyxA2BP8bSYYRGVKr2Avv',
'/ip4/10.20.0.123/tcp/4043/ipfs/QmbQvNDBqvyDEP3LUmCNJYv8bLyxA2BP8bSYYRGVKr2Avv' ]
Discovered: QmXQhdGGFJbGcQmUR4o4j4meVNR97u1GWaJt1PpfraVz1t
Connection established to: QmXQhdGGFJbGcQmUR4o4j4meVNR97u1GWaJt1PpfraVz1t
Connection established to: QmbQvNDBqvyDEP3LUmCNJYv8bLyxA2BP8bSYYRGVKr2Avv
The two 'peer:connect' events printed actually come from both halves of the same connection (since we have connected to our self) and the remote peer is not involved at all beyond the discovery broadcast. This can be verified with the full debug log found here. You can see that the advertised addresses from the remote peer contain a loopback address that we successfully connect to during dialMany().
Note that this will not occur if you attempt to connect two nodes from different ports on the same machine since the advertised loopback address will correctly reach the remote peer.
from js-libp2p.
@tullrich that certainly sounds like a bug, could you please provide a snippet that reproduces it?
from js-libp2p.
@tullrich thanks! I'll check it out shortly.
from js-libp2p.
The prescribed behavior by this issue isn't in accordance with the identify spec: https://github.com/libp2p/specs/tree/master/identify#identifypush
Closing this for now
from js-libp2p.
Related Issues (20)
- Lacking Documentation: certhash for webRTC? HOT 1
- Race Condition on opening a Stream over a DataChannel HOT 3
- ERR_ENCRYPTION_FAILED tryng to connect to go-ipfs HOT 6
- kad: FIND_NODE(self) should return multiple peers
- libp2p.components not included in typescript types. HOT 1
- autonat and upnp-nat both detect external IP address, but neither updates announced addresses. HOT 2
- libp2p crashes with ABORT_ERR HOT 5
- Memory leak issue HOT 9
- New link for js-libp2p maintainers call? HOT 5
- Circuit Relay v2 should not publish routing key without public addresses HOT 1
- Yamux pontentially sending a WindowUpdate after it has closed the stream
- Unable to run a DHT Provide Successfully HOT 5
- Cannot connect to DNS multiaddr format HOT 3
- Browser-to-server libp2p reliability HOT 3
- investigation: hanging TCPSocketWrap in js-libp2p-amino-dht-bootstrapper HOT 1
- bug: max call stack exceeded when duplicate /webrtc listeners added HOT 1
- Finding Circuit Relay V2 servers HOT 1
- Update RTCConfig for WebRTCTransport
- Deprecate `@libp2p/mplex` tracking issue HOT 1
- PubSub not recognizing subscribers/peers, when peers are subscribed to same topic. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-libp2p.