feat: add dnsnaddr p2p

This commit is contained in:
Vasco Santos 2020-10-15 14:01:04 +01:00 committed by Vasco Santos
parent 79b1b53f3d
commit 95d5178a2a
2 changed files with 7 additions and 3 deletions

View File

@ -7,9 +7,10 @@ const multiaddr = require('multiaddr')
*/ */
const DNS4 = base('dns4') const DNS4 = base('dns4')
const DNS6 = base('dns6') const DNS6 = base('dns6')
const DNSADDR = base('dnsaddr')
const DNS = or( const DNS = or(
base('dns'), base('dns'),
base('dnsaddr'), DNSADDR,
DNS4, DNS4,
DNS6 DNS6
) )
@ -71,7 +72,8 @@ const Reliable = or(
WebRTCStar, WebRTCStar,
WebRTCDirect, WebRTCDirect,
TCP, 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 ;) ) // 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.DNS = DNS
exports.DNS4 = DNS4 exports.DNS4 = DNS4
exports.DNS6 = DNS6 exports.DNS6 = DNS6
exports.DNSADDR = DNSADDR
exports.IP = IP exports.IP = IP
exports.TCP = TCP exports.TCP = TCP
exports.UDP = UDP exports.UDP = UDP

View File

@ -171,7 +171,8 @@ describe('multiaddr validation', function () {
'/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', '/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit', '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit',
'/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj' '/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj',
'/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN'
].concat(goodCircuit) ].concat(goodCircuit)
function assertMatches (p) { function assertMatches (p) {