Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
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-websockets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 728b42e29e87ce10a7f7ac555c3142924999e3af
Choose a base ref
...
head repository: libp2p/js-libp2p-websockets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e9189bbadf92dc8b524fba1b313f50fa7a00cce3
Choose a head ref
Loading
Showing with 1,120 additions and 615 deletions.
  1. +17 −15 .aegir.js
  2. +48 −0 .github/workflows/main.yml
  3. +3 −40 .gitignore
  4. +0 −46 .travis.yml
  5. +170 −0 CHANGELOG.md
  6. +47 −29 README.md
  7. +0 −2 ci/Jenkinsfile
  8. +37 −29 package.json
  9. +12 −0 src/constants.js
  10. +49 −0 src/filters.js
  11. +136 −36 src/index.js
  12. +56 −28 src/listener.js
  13. +76 −0 src/socket-to-conn.js
  14. +48 −51 test/browser.js
  15. +53 −13 test/compliance.node.js
  16. +13 −0 test/fixtures/certificate.pem
  17. +15 −0 test/fixtures/key.pem
  18. +340 −326 test/node.js
32 changes: 17 additions & 15 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
'use strict'

const multiaddr = require('multiaddr')
const pull = require('pull-stream')

const { Multiaddr } = require('multiaddr')
const pipe = require('it-pipe')
const WS = require('./src')

const mockUpgrader = {
upgradeInbound: maConn => maConn,
upgradeOutbound: maConn => maConn
}
let listener

function boot (done) {
const ws = new WS()
const ma = multiaddr('/ip4/127.0.0.1/tcp/9095/ws')
listener = ws.createListener((conn) => pull(conn, conn))
listener.listen(ma, done)
async function before () {
const ws = new WS({ upgrader: mockUpgrader })
const ma = new Multiaddr('/ip4/127.0.0.1/tcp/9095/ws')
listener = ws.createListener(conn => pipe(conn, conn))
await listener.listen(ma)
listener.on('error', console.error)
}

function shutdown (done) {
listener.close(done)
function after () {
return listener.close()
}

module.exports = {
hooks: {
browser: {
pre: boot,
post: shutdown
}
test: {
before,
after
}
}
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir lint
- run: npx aegir dep-check -- -i wrtc -i electron-webrtc
- run: npx aegir build --no-types
test-node:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [14, 16]
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
- uses: codecov/codecov-action@v1
test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir test -t browser -t webworker --bail
test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
43 changes: 3 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
docs
node_modules
package-lock.json
yarn.lock

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Vim editor swap files
*.swp

.nyc_output
docs
dist

46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

170 changes: 170 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,173 @@
# [0.16.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.9...v0.16.0) (2021-07-07)


### chore

* update deps ([#134](https://github.com/libp2p/js-libp2p-websockets/issues/134)) ([27f6c41](https://github.com/libp2p/js-libp2p-websockets/commit/27f6c4175bd6d5ea3e727a9a6e43136c806077cc))


### BREAKING CHANGES

* uses new major of mafmt, multiaddr, etc



## [0.15.9](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.8...v0.15.9) (2021-06-11)



## [0.15.8](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.7...v0.15.8) (2021-06-08)


### Bug Fixes

* listener get addrs with wss ([#130](https://github.com/libp2p/js-libp2p-websockets/issues/130)) ([ee47570](https://github.com/libp2p/js-libp2p-websockets/commit/ee47570ff79a51b8f3c3414934d5f7ab9d00f74d))



## [0.15.7](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.6...v0.15.7) (2021-05-04)



## [0.15.6](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.5...v0.15.6) (2021-04-18)



## [0.15.5](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.4...v0.15.5) (2021-04-12)



## [0.15.4](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.3...v0.15.4) (2021-03-31)



## [0.15.3](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.2...v0.15.3) (2021-02-22)



## [0.15.2](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.1...v0.15.2) (2021-02-09)


### Bug Fixes

* add error event handler ([#118](https://github.com/libp2p/js-libp2p-websockets/issues/118)) ([577d350](https://github.com/libp2p/js-libp2p-websockets/commit/577d3505f559b153ec9e0bbca7d31d2f164712bc))



## [0.15.1](https://github.com/libp2p/js-libp2p-websockets/compare/v0.15.0...v0.15.1) (2021-02-05)


### Bug Fixes

* incompatibility with @evanw/esbuild[#740](https://github.com/libp2p/js-libp2p-websockets/issues/740) ([#120](https://github.com/libp2p/js-libp2p-websockets/issues/120)) ([96244f0](https://github.com/libp2p/js-libp2p-websockets/commit/96244f048929c5225905327ae27a88961fe535f8))



# [0.15.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.1...v0.15.0) (2020-11-24)


### Bug Fixes

* add buffer ([#112](https://github.com/libp2p/js-libp2p-websockets/issues/112)) ([8065e07](https://github.com/libp2p/js-libp2p-websockets/commit/8065e07bad57b5732cdcec5ce3829ac2361604cf))
* catch thrown maConn errors in listener ([8bfb19a](https://github.com/libp2p/js-libp2p-websockets/commit/8bfb19a78f296c10d8e1a3c0ac608daa9ffcfefc))
* remove use of assert module ([#101](https://github.com/libp2p/js-libp2p-websockets/issues/101)) ([89d3723](https://github.com/libp2p/js-libp2p-websockets/commit/89d37232b8f603804b6ce5cd8230cc75d2dd8e28))
* replace node buffers with uint8arrays ([#115](https://github.com/libp2p/js-libp2p-websockets/issues/115)) ([a277bf6](https://github.com/libp2p/js-libp2p-websockets/commit/a277bf6bfbc7ad796e51f7646d7449c203384c06))


### Features

* custom address filter ([#116](https://github.com/libp2p/js-libp2p-websockets/issues/116)) ([711c721](https://github.com/libp2p/js-libp2p-websockets/commit/711c721b033d28b3c57c37bf9ca98d0f5d2a58b6))


### BREAKING CHANGES

* Only DNS+WSS addresses are now returned on filter by default in the browser. This can be overritten by the filter option and filters are provided in the module.



<a name="0.14.0"></a>
# [0.14.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.6...v0.14.0) (2020-08-11)


### Bug Fixes

* replace node buffers with uint8arrays ([#115](https://github.com/libp2p/js-libp2p-websockets/issues/115)) ([a277bf6](https://github.com/libp2p/js-libp2p-websockets/commit/a277bf6))


### BREAKING CHANGES

* - All deps used by this module now use Uint8Arrays in place of Buffers

* chore: remove gh dep



<a name="0.13.6"></a>
## [0.13.6](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.5...v0.13.6) (2020-03-23)


### Bug Fixes

* add buffer ([#112](https://github.com/libp2p/js-libp2p-websockets/issues/112)) ([8065e07](https://github.com/libp2p/js-libp2p-websockets/commit/8065e07))



<a name="0.13.5"></a>
## [0.13.5](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.4...v0.13.5) (2020-02-26)


### Bug Fixes

* catch thrown maConn errors in listener ([8bfb19a](https://github.com/libp2p/js-libp2p-websockets/commit/8bfb19a))



<a name="0.13.4"></a>
## [0.13.4](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.3...v0.13.4) (2020-02-14)


### Bug Fixes

* remove use of assert module ([#101](https://github.com/libp2p/js-libp2p-websockets/issues/101)) ([89d3723](https://github.com/libp2p/js-libp2p-websockets/commit/89d3723))



<a name="0.13.3"></a>
## [0.13.3](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.2...v0.13.3) (2020-02-07)



<a name="0.13.2"></a>
## [0.13.2](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.1...v0.13.2) (2019-12-20)



<a name="0.13.1"></a>
## [0.13.1](https://github.com/libp2p/js-libp2p-websockets/compare/v0.13.0...v0.13.1) (2019-10-30)


### Bug Fixes

* catch inbound upgrade errors ([#96](https://github.com/libp2p/js-libp2p-websockets/issues/96)) ([5b59fc3](https://github.com/libp2p/js-libp2p-websockets/commit/5b59fc3))
* support bufferlist usage ([#97](https://github.com/libp2p/js-libp2p-websockets/issues/97)) ([3bf66d0](https://github.com/libp2p/js-libp2p-websockets/commit/3bf66d0))



<a name="0.13.0"></a>
# [0.13.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.3...v0.13.0) (2019-09-30)


### Code Refactoring

* async with multiaddr conn ([#92](https://github.com/libp2p/js-libp2p-websockets/issues/92)) ([ce7bf4f](https://github.com/libp2p/js-libp2p-websockets/commit/ce7bf4f))


### BREAKING CHANGES

* Switch to using async/await and async iterators. The transport and connection interfaces have changed. See the README for new usage.



<a name="0.12.3"></a>
## [0.12.3](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.2...v0.12.3) (2019-08-21)

Loading