Converts this module to typescript.
- Ecosystem modules renamed from (e.g.) `libp2p-tcp` to `@libp2p/tcp`
- Ecosystem module now have named exports
- Configuration has been updated, now pass instances of modules instead of classes:
- Some configuration keys have been renamed to make them more descriptive. `transport` -> `transports`, `connEncryption` -> `connectionEncryption`. In general where we pass multiple things, the key is now plural, e.g. `streamMuxer` -> `streamMuxers`, `contentRouting` -> `contentRouters`, etc. Where we are configuring a singleton the config key is singular, e.g. `connProtector` -> `connectionProtector` etc.
- Properties of the `modules` config key have been moved to the root
- Properties of the `config` config key have been moved to the root
```js
// before
import Libp2p from 'libp2p'
import TCP from 'libp2p-tcp'
await Libp2p.create({
modules: {
transport: [
TCP
],
}
config: {
transport: {
[TCP.tag]: {
foo: 'bar'
}
},
relay: {
enabled: true,
hop: {
enabled: true,
active: true
}
}
}
})
```
```js
// after
import { createLibp2p } from 'libp2p'
import { TCP } from '@libp2p/tcp'
await createLibp2p({
transports: [
new TCP({ foo: 'bar' })
],
relay: {
enabled: true,
hop: {
enabled: true,
active: true
}
}
})
```
- Use of `enabled` flag has been reduced - previously you could pass a module but disable it with config. Now if you don't want a feature, just don't pass an implementation. Eg:
```js
// before
await Libp2p.create({
modules: {
transport: [
TCP
],
pubsub: Gossipsub
},
config: {
pubsub: {
enabled: false
}
}
})
```
```js
// after
await createLibp2p({
transports: [
new TCP()
]
})
```
- `.multiaddrs` renamed to `.getMultiaddrs()` because it's not a property accessor, work is done by that method to calculate announce addresses, observed addresses, etc
- `/p2p/${peerId}` is now appended to all addresses returned by `.getMultiaddrs()` so they can be used opaquely (every consumer has to append the peer ID to the address to actually use it otherwise). If you need low-level unadulterated addresses, call methods on the address manager.
BREAKING CHANGE: types are no longer hand crafted, this module is now ESM only
BREAKING CHANGES:
top level types were updated, multiaddr@9.0.0 is used, dialer and keychain internal property names changed and connectionManager minPeers is not supported anymore
* feat: add uPnP nat manager
Adds a really basic nat manager that attempts to use UPnP to punch
a hole through your router for any IPV4 tcp addresses you have
configured.
Adds any configured addresses to the node's observed addresses list
and adds observed addresses to `libp2p.multiaddrs` so we exchange
them with peers when performing `identify` and people can dial you.
Adds configuration options under `config.nat`
Hole punching is async to not affect start up time.
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
* feat: gossipsub 1.1
BREAKING CHANGE: pubsub implementation is now directly exposed and its API was updated according to the new pubsub interface in js-libp2p-interfaces repo
* chore: use gossipsub branch with src added
* fix: add pubsub handlers adapter
* chore: fix deps
* chore: update pubsub docs and examples
* chore: apply suggestions from code review
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
* chore: use new floodsub
* chore: change validator doc set
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
* chore: add new gossipsub src
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
* fix: replace node buffers with uint8arrays
Upgrades all deps and replaces all use of node Buffers with Uint8Arrays
BREAKING CHANGES:
- All deps used by this module now use Uint8Arrays in place of node Buffers
* chore: browser fixes
* chore: remove .only
* chore: stringify uint8array before parsing
* chore: update interop suite
* chore: remove ts from build command
* chore: update deps
* fix: update records to use uint8array
* chore: fix lint
* chore: update deps
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
* fix: not dial all known peers on startup
* feat: connection manager should proactively connect to peers from peerStore
* chore: increase bundle size
* fix: do connMgr proactive dial on an interval
* chore: address review
* chore: use retimer reschedule
* chore: address review
* fix: use minConnections in default config
* chore: minPeers to minConnections everywhere
BREAKING CHANGE: all API methods with peer-info parameters or return values were changed. You can check the API.md document, in order to check the new values to use
* fix: use new libp2p-crypto
* fix: remove node globals and reduce size
- adds buffer require
- adds globalThis where needed
- streaming-iterables was remove and new utils created, this will be consolidated in `ipfs-utils` and backported here to normalize all these iterator helper functions
- latency-monitor was copied inside the repo
- iso-random-stream is now used instead of node crypto
- the test `should ignore self on discovery` was moved to node only
Size: 172.97KB
47.03KB below the 220KB limit.
`aegir build --node false` and `aegir test -t browser --node false` now work 🎉
* fix: fix require path
* fix: feedback
* fix: update deps and bundle size
* chore: bump interfaces
* chore: update size
* refactor: add dialing over relay support
* chore: fix lint
* fix: dont clear listeners on close
* fix: if dial errors already have codes, just rethrow them
* fix: clear the registrar when libp2p stops
* fix: improve connection maintenance with circuit
* chore: correct feedback
* test: use chai as promised
* test(fix): reset multiaddrs on dial test
* test: remove all tests for a clean slate
The refactor will require a large number of updates to the tests. In order
to ensure we have done a decent deduplication, and have a cleaner suite of tests
we've removed all tests. This will also allow us to more easily see tests
for the refactored systems.
We have a record of the latest test suites in master, so we are not losing any history.
* chore: update tcp and websockets
* chore: remove other transports until they are converted
* chore: use mafmt and multiaddr async versions
* chore: add and fix dependencies
* chore: clean up travis file
* feat: add new transport manager
* docs: add constructor jsdocs
* refactor(config): check that transports exist
This also removes the other logic, it can be added when those subsystems are refactored
* chore(deps): use async peer-id and peer-info
* feat: wire up the transport manager with libp2p
* chore: remove superstruct dep
* chore: update ws rendezvous dep
test(fix): fix tests with latest ws rendezvous server
* fix: promisification of libp2p methods
test: add tests to verify promisify support until async/await endeavor is complete
* chore: fix linting
* docs: update chat example and add info to its readme
* docs: update echo example
* docs: update libp2p in browser example
* docs: update pubsub example
* docs: update peer and content routing examples
* docs: update discovery mechanisms example
* docs: update encrypted comms example
* docs: update protocol and stream muxing example
* feat: add config validation
* test: update CI configs, use only node 8
* feat: new super simplified API
* feat: append peer id to multiaddr if not there
* [WIP] Awesome DHT (#86)
* feat: integrate dht
* better interfaces
* docs: add documentation for peerRouting, contentRouting, dht
* fix: take in passed datastore
* fix: update usage of _getPeerInfo
* fix: getPeerInfo
* docs: update docs
* moar
feat: correctly handle p2p-circuit addrs when creating a peer info object
refactor: rework config options
* feat: adding circuit relaying
* feat: rework circuit relay for protobufs
* feat: circuit loading and tests
* fix: clean up _getPeerInfo to work with /p2p-circuit
* wip: tests cleaup
* test: clean up
* wip
* fix: bringing back test reworks and new aegir
* test: group tests
* test: clean up
* test: adjust test
* fix: use getPeerId to determine if the ipfs fragment is missing
* feat: adding circuit relaying
* feat: circuit loading and tests
* test: clean up
* wip
* feat: upgrade to latest aegir
* fix: removing unused tests
* feat: cleanup tests
* fix: create node defautl options
* chore: upgrade swarm to latest version
* fix: updated aegir and adjust timeouts
* feat: more timeouts
* chore: updating deps
* fix: circle ci builds
* test: timeouts