fix: add webrtc direct with p2p as valid P2P multiaddr (#71)

This commit is contained in:
Vasco Santos 2021-01-11 10:16:51 +01:00 committed by GitHub
parent f5beeee47c
commit c8430c1556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -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')
)

View File

@ -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',