Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: libp2p/js-libp2p
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4a995613ae335fd30f3fb57c04a9a2d5aeecee32
Choose a base ref
...
head repository: libp2p/js-libp2p
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6d0ac819f11c6efcd662b0b402c47180ecf35b2b
Choose a head ref
Loading
Showing 316 changed files with 36,490 additions and 4,126 deletions.
70 changes: 70 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict'

const path = require('path')
const Libp2p = require('./src')
const { MULTIADDRS_WEBSOCKETS } = require('./test/fixtures/browser')
const Peers = require('./test/fixtures/peers')
const PeerId = require('peer-id')
const WebSockets = require('libp2p-websockets')
const Muxer = require('libp2p-mplex')
const { NOISE: Crypto } = require('@chainsafe/libp2p-noise')
const pipe = require('it-pipe')
let libp2p

const before = async () => {
// Use the last peer
const peerId = await PeerId.createFromJSON(Peers[Peers.length - 1])

libp2p = new Libp2p({
addresses: {
listen: [MULTIADDRS_WEBSOCKETS[0]]
},
peerId,
modules: {
transport: [WebSockets],
streamMuxer: [Muxer],
connEncryption: [Crypto]
},
config: {
relay: {
enabled: true,
hop: {
enabled: true,
active: false
}
},
nat: {
enabled: false
}
}
})
// Add the echo protocol
libp2p.handle('/echo/1.0.0', ({ stream }) => pipe(stream, stream))

await libp2p.start()
}

const after = async () => {
await libp2p.stop()
}

/** @type {import('aegir').Options["build"]["config"]} */
const esbuild = {
inject: [path.join(__dirname, './scripts/node-globals.js')]
}

/** @type {import('aegir').PartialOptions} */
module.exports = {
build: {
bundlesizeMax: '253kB'
},
test: {
before,
after,
browser: {
config: {
buildConfig: esbuild
}
}
}
}
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: libp2p Official Forum
url: https://discuss.libp2p.io
about: For general questions, support requests and discussions
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/open_an_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Open an issue
about: For reporting bugs or errors in the JavaScript libp2p implementation
title: ''
labels: need/triage
assignees: ''
---

<!--
Thank you for reporting an issue.
This issue tracker is for bugs found within the JavaScript implementation of libp2p.
If you are asking a question about how to use libp2p, please ask on https://discuss.libp2p.io
Otherwise please fill in as much of the template below as possible.
-->

- **Version**:
<!--
Check package.json version
-->

- **Platform**:
<!--
Output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows). If using in a Browser, please share the browser version as well
-->

- **Subsystem**:
<!--
If known, please specify affected core module name (e.g Dialer, Pubsub, Relay etc)
-->

#### Severity:
<!--
One of following:
Critical - System crash, application panic.
High - The main functionality of the application does not work, API breakage, repo format breakage, etc.
Medium - A non-essential functionality does not work, performance issues, etc.
Low - An optional functionality does not work.
Very Low - Translation or documentation mistake. Something that won't give anyone a bad day.
-->

#### Description:
<!--
- What you did
- What happened
- What you expected to happen
-->

#### Steps to reproduce the error:
<!--
If possible, please provide code that demonstrates the problem, keeping it as simple and free of external dependencies as you are able
-->

58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Release Template

> short tl;dr; of the release
# 🗺 What's left for release

# 🔦 Highlights

# 🏗 API Changes

# ✅ Release Checklist

- Robustness and quality
- [ ] Ensure that all tests are passing, this includes:
- [ ] unit
- [ ] Publish a release candidate to npm
```sh
# Minor prerelease (e.g. 0.24.1 -> 0.25.0-rc.0)
$ npx aegir release --type preminor -t node -t browser --preid rc --dist-tag next

# Increment prerelease (e.g. 0.25.0-rc.0 -> 0.25.0-rc.1)
$ npx aegir release --type prerelease -t node -t browser --preid rc --dist-tag next
```
- [ ] Run tests of the following projects with the new release:
- [ ] [js-ipfs](https://github.com/ipfs/js-ipfs)
- Documentation
- [ ] Ensure that README.md is up to date
- [ ] Ensure that [libp2p/docs](https://github.com/libp2p/docs) is updated
- Communication
- [ ] Create the release issue
- [ ] Take a snapshot between of everyone that has contributed to this release (including its subdeps in IPFS, libp2p, IPLD and multiformats) using [`name-your-contributors`](https://www.npmjs.com/package/name-your-contributors). Generate a nice markdown list with [this script](https://gist.github.com/jacobheun/d2ff479ca991733c13cdcf688a1317e5)
- [ ] Announcements (both pre-release and post-release)
- [ ] Twitter
- [ ] IRC
- [ ] Reddit
- [ ] [discuss.libp2p.io](https://discuss.libp2p.io/c/news)
- [ ] Blog post
- [ ] Copy release notes to the [GitHub Release description](https://github.com/libp2p/js-libp2p/releases)

# ❤️ Huge thank you to everyone that made this release possible

In alphabetical order, here are all the humans that contributed to the release:

- ...

# 🙌🏽 Want to contribute?

Would you like to contribute to the libp2p project and don't know how? Well, there are a few places you can get started:
- Check the issues with the `help wanted` label in the [libp2p repo](https://github.com/libp2p/js-libp2p/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
- Join an IPFS All Hands, introduce yourself and let us know where you would like to contribute - https://github.com/ipfs/team-mgmt#all-hands-call
- Hack with IPFS and show us what you made! The All Hands call is also the perfect venue for demos, join in and show us what you built
- Join the discussion at http://discuss.libp2p.io/ and help users finding their answers.
- Join the [⚡️libp2p Weekly Sync 🙌🏽](https://github.com/libp2p/team-mgmt/issues/16) and be part of the Sprint action!
# ⁉️ Do you have questions?
The best place to ask your questions about libp2p, how it works and what you can do with it is at [discuss.libp2p.io](https://discuss.libp2p.io). We are also available at the #libp2p channel on Freenode.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "11:00"
open-pull-requests-limit: 10
141 changes: 141 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: examples
on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npx aegir lint
- run: npx aegir ts -p check
- run: npx aegir build
test-auto-relay-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- auto-relay
test-chat-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- chat
test-connection-encryption-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- connection-encryption
test-discovery-mechanisms-example:
needs: check
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- discovery-mechanisms
test-echo-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- echo
test-libp2p-in-the-browser-example:
needs: check
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- libp2p-in-the-browser
test-peer-and-content-routing-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- peer-and-content-routing
test-pnet-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- pnet
test-protocol-and-stream-muxing-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- protocol-and-stream-muxing
test-pubsub-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- pubsub
test-transports-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: cd examples && npm i && npm run test -- transports
test-webrtc-direct-example:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install -g @mapbox/node-pre-gyp && npm install
- run: cd examples && npm i && npm run test -- webrtc-direct
Loading