Hi! Is there a way to filter out dial addrs with more than IP ranges? I want my node to listen on websocket but only dial TCP.
raul
April 14, 2020, 7:03pm
2
Hey @tobowers , sorry for the slow turnaround. What implementation are you using? We are currently busy implementing a Connection Gater component in go-libp2p. Have a look at:
master
← feat/connection-gater
opened 11:35AM - 11 Dec 19 UTC
For https://github.com/libp2p/go-libp2p/issues/872.
Some downstreams (e.g. Pr… ysmatic, @prestonvanloon, @nisdas) need to actively and strictly limit/deny outbound and inbound connection attempts, after a limit has been reached. On the other hand, other downstreams like Filecoin require peer blacklisting capability.
Enhancing go-libp2p-swarm with peer/connection limit or blacklisting functionality is a dirty solution. The right place to put this concern is in the connection management domain. But not all connection manager implementations will want to act as firewalls or blacklisters.
This PR sketches out a `ConnectionGater` interface that connmgr implementations can implement. The swarm tests if the interface is implemented, and if so, calls `AllowConnection()` before performing any dials (outgoing connection), or incorporating a candidate connection to the swarm (incoming connection). Ideally we'd stop incoming connections at the transport layer, but injecting the connmgr so deep is not something I'm comfortable with.
**TODO:**
- [ ] Gracefully disconnecting the other party -- DISCONNECT protocol: https://github.com/libp2p/go-libp2p/issues/238. If we don't implement this, the other party has no way of knowing if the disconnection was product of a network hiccup, or if it was intentional. And they may try to reconnect.
- [ ] Add the call sites in the swarm.
Before I finish up the remaining work, I'd love to gather some feedback.
Relates to https://github.com/libp2p/go-libp2p-swarm/pull/146.
And linked PRs and issues.
Thanks! We use both, but the question is for go-libp2p so thanks!