include ipfs for webrtcstar validation

This commit is contained in:
David Dias 2016-05-21 23:34:53 +01:00
parent 4ed44eb35a
commit 2ae350af5a
2 changed files with 3 additions and 4 deletions

View File

@ -7,7 +7,7 @@ var TCP = and(IP, base('tcp'))
var UDP = and(IP, base('udp')) var UDP = and(IP, base('udp'))
var UTP = and(UDP, base('utp')) var UTP = and(UDP, base('utp'))
var WebSockets = and(TCP, base('ws')) var WebSockets = and(TCP, base('ws'))
var WebRTCStar = and(base('libp2p-webrtc-star'), WebSockets) var WebRTCStar = and(base('libp2p-webrtc-star'), WebSockets, base('ipfs'))
var Reliable = or(TCP, UTP) var Reliable = or(TCP, UTP)
var IPFS = and(Reliable, base('ipfs')) var IPFS = and(Reliable, base('ipfs'))
@ -38,7 +38,6 @@ function and () {
if (a.length < args.length) { if (a.length < args.length) {
return null return null
} }
args.some(function (arg) { args.some(function (arg) {
a = arg.partialMatch(a) a = arg.partialMatch(a)
if (a === null) { if (a === null) {

View File

@ -52,8 +52,8 @@ describe('multiaddr validation', function () {
] ]
var goodWebRTCStar = [ var goodWebRTCStar = [
'/libp2p-webrtc-star/ip4/1.2.3.4/tcp/3456/ws', '/libp2p-webrtc-star/ip4/1.2.3.4/tcp/3456/ws/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/libp2p-webrtc-star/ip6/::/tcp/0/ws' '/libp2p-webrtc-star/ip6/::/tcp/0/ws/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo5'
] ]
var badWS = [ var badWS = [