Skip to content
Compare
Choose a tag to compare

v0.30.0

@vasco-santos vasco-santos released this
· 330 commits to master since this release
Compare
Choose a tag to compare

🔦 Highlights

📝 Type definitions

js-libp2p is now distributed with type definitions for TypeScript in its core API. We are using JSDoc to type the code inline and aegir for type checking and generate type definitions on release.

Upstream typescript projects have been leveraging projects like https://github.com/ChainSafe/libp2p-ts to have definitions for libp2p. With 0.30 typescript projects can start using the built in libp2p types.

This will also enable us to provide automated (and updated) docs, without the need to manually keep them.

🌐 Auto relay

AutoRelay enables libp2p nodes to dynamically find and bind to relays on the network. Once binding (listening) is done, the node can and should advertise its addresses to the network, allowing any other node to dial it over its bound relay(s). While direct connections to nodes are preferable, it's not always possible to do so due to NATs or browser limitations.

This is a crucial feature in terms of connectivity for some peers in the network, which will now be able to connect to other peers in a more independent fashion.

🗺 Improved Peer advertising and Dialer mechanics

Libp2p announces all the addresses a peer is listening on. However, most of the time these addresses include local private addresses, which as expected are not reachable. With peer store persistence, other peers will store (and even exchange) these local private addresses that will not be useful for others. Libp2p now supports a customAnnounceFilter function that enables via config to not announce any private addresses for instance. For simplifying this even more, libp2p-utils already has some filters that can just be imported and used.

libp2p-websockets has allowed TCP and DNS addresses, both with ws or wss, to be used for dialling. This should not be the default scenario due to security and browser policies. Now, libp2p-websockets will only support DNS based multiaddrs, as well as supporting wss only in the browser. And yes, you still need other types of multiaddrs for testing/development and we got you covered. You can override the websockets filter config easily via transport config options.

On more general dialer mechanics enhancements, the dialer will now sort the known addresses of a peer on a public and certified first logic. This way, the dialer will try to dial first the addresses that in theory will be more likely to work. This behaviour can also be configured via a custom function in the config.

Last but not least, in order for other nodes on the network to easily find a given libp2p node, this node will now recurrently find its closest peers on the network, connect to them and exchange its address records. This will enable other peers on the network to find a peer in an easier and faster fashion.

📂 Production Guides and Examples improvements

Taking into account the importante of the Auto relay, this release also comes with comprehensive examples and production guides on how the needed infrastructure blocks should be setup.

🏗 API Changes

https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.29-v0.30.md

Bug Fixes

  • remove test/dialing/utils extra file (689c35e)
  • types from ipfs integration (#832) (9ae1b75)

chore

Features

BREAKING CHANGES

  • pubsub signing policy properties were changed according to libp2p-interfaces changes to a single property. The emitSelf option default value was also modified to match the routers value