diff --git a/src/connection/.travis.yml b/.travis.yml
similarity index 100%
rename from src/connection/.travis.yml
rename to .travis.yml
diff --git a/package.json b/package.json
index 23bc619..af725ab 100644
--- a/package.json
+++ b/package.json
@@ -32,8 +32,18 @@
},
"homepage": "https://github.com/libp2p/js-interfaces#readme",
"dependencies": {
+ "abortable-iterator": "^2.1.0",
+ "chai": "^4.2.0",
+ "class-is": "^1.1.0",
+ "dirty-chai": "^2.0.1",
+ "err-code": "^2.0.0",
+ "multiaddr": "^7.1.0",
+ "peer-id": "^0.13.3",
+ "sinon": "^7.5.0"
},
"devDependencies": {
- "aegir": "^20.4.1"
+ "aegir": "^20.4.1",
+ "it-pair": "^1.0.0",
+ "it-pipe": "^1.0.1"
}
}
diff --git a/src/connection/.gitignore b/src/connection/.gitignore
deleted file mode 100644
index 229031f..0000000
--- a/src/connection/.gitignore
+++ /dev/null
@@ -1,30 +0,0 @@
-# Logs
-logs
-*.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
-# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
-node_modules
-
-dist
-package-lock.json
diff --git a/src/connection/.npmignore b/src/connection/.npmignore
deleted file mode 100644
index 00a160d..0000000
--- a/src/connection/.npmignore
+++ /dev/null
@@ -1,29 +0,0 @@
-# Logs
-logs
-*.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
-# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
-node_modules
-
-test
diff --git a/src/connection/CHANGELOG.md b/src/connection/CHANGELOG.md
deleted file mode 100644
index 53e87fa..0000000
--- a/src/connection/CHANGELOG.md
+++ /dev/null
@@ -1,115 +0,0 @@
-
-## [0.4.1](https://github.com/libp2p/interface-connection/compare/v0.4.0...v0.4.1) (2019-10-17)
-
-
-### Features
-
-* add support for timeline proxying ([#31](https://github.com/libp2p/interface-connection/issues/31)) ([541bf83](https://github.com/libp2p/interface-connection/commit/541bf83))
-
-
-
-
-# [0.4.0](https://github.com/libp2p/interface-connection/compare/v0.3.3...v0.4.0) (2019-09-27)
-
-
-### Code Refactoring
-
-* API changes and switch to async iterators ([#29](https://github.com/libp2p/interface-connection/issues/29)) ([bf5c646](https://github.com/libp2p/interface-connection/commit/bf5c646))
-
-
-### BREAKING CHANGES
-
-* all the callbacks in the provided API were removed and each function uses async/await. Additionally, pull-streams are no longer being used. See the README for new usage.
-
-
-
-
-## [0.3.3](https://github.com/libp2p/interface-connection/compare/v0.3.1...v0.3.3) (2018-11-29)
-
-
-
-
-## [0.3.1](https://github.com/libp2p/interface-connection/compare/v0.3.0...v0.3.1) (2017-02-09)
-
-
-
-
-# [0.3.0](https://github.com/libp2p/interface-connection/compare/v0.2.1...v0.3.0) (2016-11-03)
-
-
-### Features
-
-* async crypto + sauce labs + aegir 9 ([b40114c](https://github.com/libp2p/interface-connection/commit/b40114c))
-
-
-
-
-## [0.2.1](https://github.com/libp2p/interface-connection/compare/v0.2.0...v0.2.1) (2016-09-05)
-
-
-### Bug Fixes
-
-* **package.json:** point to right main ([84cd2ca](https://github.com/libp2p/interface-connection/commit/84cd2ca))
-
-
-
-
-# [0.2.0](https://github.com/libp2p/interface-connection/compare/v0.1.8...v0.2.0) (2016-09-05)
-
-
-### Bug Fixes
-
-* **deps:** fix package.json ([e0f7db3](https://github.com/libp2p/interface-connection/commit/e0f7db3))
-
-
-### Features
-
-* **connection:** migrate to pull-streams ([ed5727a](https://github.com/libp2p/interface-connection/commit/ed5727a))
-
-
-
-
-## [0.1.8](https://github.com/libp2p/interface-connection/compare/v0.1.7...v0.1.8) (2016-08-03)
-
-
-
-
-## [0.1.7](https://github.com/libp2p/interface-connection/compare/v0.1.6...v0.1.7) (2016-06-27)
-
-
-
-
-## [0.1.6](https://github.com/libp2p/interface-connection/compare/v0.1.5...v0.1.6) (2016-06-23)
-
-
-
-
-## [0.1.5](https://github.com/libp2p/interface-connection/compare/v0.1.4...v0.1.5) (2016-06-23)
-
-
-
-
-## [0.1.4](https://github.com/libp2p/interface-connection/compare/v0.1.3...v0.1.4) (2016-06-23)
-
-
-
-
-## [0.1.3](https://github.com/libp2p/interface-connection/compare/v0.1.0...v0.1.3) (2016-06-16)
-
-
-
-
-# [0.1.0](https://github.com/libp2p/interface-connection/compare/v0.0.3...v0.1.0) (2016-06-16)
-
-
-
-
-## [0.0.3](https://github.com/libp2p/interface-connection/compare/v0.0.1...v0.0.3) (2015-12-12)
-
-
-
-
-## 0.0.1 (2015-09-17)
-
-
-
diff --git a/src/connection/LICENSE b/src/connection/LICENSE
deleted file mode 100644
index 59a33ba..0000000
--- a/src/connection/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 David Dias
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/src/connection/README.md b/src/connection/README.md
index a6b8246..ee1df68 100644
--- a/src/connection/README.md
+++ b/src/connection/README.md
@@ -1,25 +1,12 @@
interface-connection
==================
-[](http://protocol.ai)
-[](http://libp2p.io/)
-[](http://webchat.freenode.net/?channels=%23libp2p)
-[](https://discuss.libp2p.io)
-[](https://codecov.io/gh/libp2p/interface-connection)
-[](https://travis-ci.com/libp2p/interface-connection)
-[](https://david-dm.org/libp2p/interface-connection)
-[](https://github.com/feross/standard)
-
This is a test suite and interface you can use to implement a connection. The connection interface contains all the metadata associated with it, as well as an array of the streams opened through this connection. In the same way as the connection, a stream contains properties with its metadata, plus an iterable duplex object that offers a mechanism for writing and reading data, with back pressure. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer.
The primary goal of this module is to enable developers to pick, swap or upgrade their connection without losing the same API expectations and mechanisms such as back pressure and the ability to half close a connection.
Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite.
-## Lead Maintainer
-
-[Jacob Heun](https://github.com/jacobheun/)
-
## Usage
### Connection
@@ -37,12 +24,12 @@ This helps ensuring that the transport is responsible for socket management, whi
### Test suite
-#### JS
-
```js
+const tests = require('libp2p-interfaces/src/connection/tests')
describe('your connection', () => {
- require('interface-connection/src/tests')({
- async setup () {
+ tests({
+ // Options should be passed to your connection
+ async setup (options) {
return YourConnection
},
async teardown () {
@@ -52,10 +39,6 @@ describe('your connection', () => {
})
```
-#### Go
-
-> WIP
-
## API
### Connection
diff --git a/src/connection/test/connection.js b/src/connection/tests/connection.js
similarity index 100%
rename from src/connection/test/connection.js
rename to src/connection/tests/connection.js
diff --git a/src/connection/tests.js b/src/connection/tests/index.js
similarity index 63%
rename from src/connection/tests.js
rename to src/connection/tests/index.js
index 8a80dae..d008297 100644
--- a/src/connection/tests.js
+++ b/src/connection/tests/index.js
@@ -2,7 +2,7 @@
'use strict'
-const connectionSuite = require('../test/connection')
+const connectionSuite = require('./connection')
module.exports = (test) => {
connectionSuite(test)
diff --git a/src/connection/test/compliance.spec.js b/test/connection/compliance.spec.js
similarity index 91%
rename from src/connection/test/compliance.spec.js
rename to test/connection/compliance.spec.js
index decbdd2..fd4f994 100644
--- a/src/connection/test/compliance.spec.js
+++ b/test/connection/compliance.spec.js
@@ -1,9 +1,9 @@
/* eslint-env mocha */
'use strict'
-const tests = require('../src/tests')
-const Connection = require('../src/connection')
-const peers = require('./utils/peers')
+const tests = require('../../src/connection/tests')
+const { Connection } = require('../../src/connection')
+const peers = require('../utils/peers')
const PeerId = require('peer-id')
const multiaddr = require('multiaddr')
const pair = require('it-pair')
diff --git a/src/connection/test/utils/peers.js b/test/utils/peers.js
similarity index 100%
rename from src/connection/test/utils/peers.js
rename to test/utils/peers.js