From 95d5178a2a7e68bbc4452a5f2c1ab6a42c7b1b97 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 15 Oct 2020 14:01:04 +0100 Subject: [PATCH] feat: add dnsnaddr p2p --- src/index.js | 7 +++++-- test/index.spec.js | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index f2f8531..5636c94 100644 --- a/src/index.js +++ b/src/index.js @@ -7,9 +7,10 @@ const multiaddr = require('multiaddr') */ const DNS4 = base('dns4') const DNS6 = base('dns6') +const DNSADDR = base('dnsaddr') const DNS = or( base('dns'), - base('dnsaddr'), + DNSADDR, DNS4, DNS6 ) @@ -71,7 +72,8 @@ const Reliable = or( WebRTCStar, WebRTCDirect, TCP, - UTP + UTP, + DNSADDR ) // Unlike ws-star, stardust can run over any transport thus removing the requirement for websockets (but don't even think about running a stardust server over webrtc-star ;) ) @@ -113,6 +115,7 @@ const P2P = or( exports.DNS = DNS exports.DNS4 = DNS4 exports.DNS6 = DNS6 +exports.DNSADDR = DNSADDR exports.IP = IP exports.TCP = TCP exports.UDP = UDP diff --git a/test/index.spec.js b/test/index.spec.js index aad7b16..3321087 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -171,7 +171,8 @@ describe('multiaddr validation', function () { '/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit', - '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj' + '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj', + '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN' ].concat(goodCircuit) function assertMatches (p) {