From c8430c1556edf687d22f2c00eb3b6ff96b580aa5 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 11 Jan 2021 10:16:51 +0100 Subject: [PATCH] fix: add webrtc direct with p2p as valid P2P multiaddr (#71) --- src/index.js | 3 +++ test/index.spec.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index f3426e3..c3532c4 100644 --- a/src/index.js +++ b/src/index.js @@ -60,6 +60,8 @@ const WebSocketStar = or( ) const WebRTCDirect = or( + and(HTTP, base('p2p-webrtc-direct'), base('p2p')), + and(HTTPS, base('p2p-webrtc-direct'), base('p2p')), and(HTTP, base('p2p-webrtc-direct')), and(HTTPS, base('p2p-webrtc-direct')) ) @@ -85,6 +87,7 @@ const Stardust = or( const _P2P = or( and(Reliable, base('p2p')), WebRTCStar, + WebRTCDirect, base('p2p') ) diff --git a/test/index.spec.js b/test/index.spec.js index b6011b2..4fb86a9 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -162,6 +162,7 @@ describe('multiaddr validation', function () { const goodIPFS = [ '/ip4/127.0.0.1/tcp/20008/ws/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj', '/ip4/1.2.3.4/tcp/3456/ws/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', + '/ip4/127.0.0.1/tcp/9090/http/p2p-webrtc-direct/p2p/QmPj9ZZ6notLfV9khV1FtxH1Goe5sVaUyqgoXrTYQWp382', '/ip4/1.2.3.4/tcp/3456/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', '/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit', '/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj',