Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
feat: listen to array of multiaddrs (#104)
Browse files Browse the repository at this point in the history
* feat: support listen on array

* chore: fix missing deps

* chore: update interface version

* docs: update readme for array listen

* test: use port 0

* docs: add some more jsdocs

* chore: fix travis support for ip6 on linux

* refactor: clean up some code
  • Loading branch information
jacobheun committed Apr 22, 2019
1 parent 1ffd549 commit 5009c2c
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 124 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ stages:
node_js:
- '10'

os:
- linux
- osx

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
include:
- os: linux
sudo: false
before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'

- os: windows
filter_secrets: false
cache: false

- os: osx

- stage: check
os: linux
script:
- npx aegir build --bundlesize
- npx aegir commitlint --travis
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const multiaddr = require('multiaddr')
const pipe = require('it-pipe')
const { collect } = require('streaming-iterables')

const mh = multiaddr('/ip4/127.0.0.1/tcp/9090')
const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')

const tcp = new TCP()

Expand All @@ -56,10 +56,10 @@ const listener = tcp.createListener((socket) => {
)
})

await listener.listen(mh)
await listener.listen([addr])
console.log('listening')

const socket = await tcp.dial(mh)
const socket = await tcp.dial(addr)
const values = await pipe(
socket,
collect
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@
"aegir": "^18.1.1",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"interface-transport": "~0.3.6",
"lodash.isfunction": "^3.0.9",
"pull-stream": "^3.6.9",
"sinon": "^7.3.1"
},
"dependencies": {
"abort-controller": "^3.0.0",
"class-is": "^1.1.0",
"debug": "^3.1.0",
"debug": "^4.1.1",
"err-code": "^1.1.2",
"interface-connection": "~0.3.3",
"interface-transport": "libp2p/interface-transport#feat/async-await",
"interface-transport": "~0.4.0",
"ip-address": "^5.8.9",
"it-pipe": "^1.0.0",
"lodash.includes": "^4.3.0",
"lodash.isfunction": "^3.0.9",
"mafmt": "^6.0.2",
"multiaddr": "^5.0.0"
"mafmt": "^6.0.7",
"multiaddr": "^6.0.6",
"streaming-iterables": "^4.1.0"
},
"contributors": [
"Alan Shaw <alan@tableflip.io>",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class TCP {
}

handler = handler || noop
return createListener(handler)
return createListener(options, handler)
}

filter (multiaddrs) {
Expand Down
Loading

0 comments on commit 5009c2c

Please sign in to comment.