diff --git a/package.json b/package.json index e652f2d..888a61c 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "pre-commit": "^1.1.2" }, "dependencies": { - "multiaddr": "^2.0.0" + "multiaddr": "^2.0.2" }, "contributors": [ "David Dias ", @@ -47,4 +47,4 @@ "Jeromy Johnson ", "dignifiedquire " ] -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index 0e01188..0faa85c 100644 --- a/src/index.js +++ b/src/index.js @@ -7,6 +7,7 @@ var TCP = and(IP, base('tcp')) var UDP = and(IP, base('udp')) var UTP = and(UDP, base('utp')) var WebSockets = and(TCP, base('ws')) +var WebRTCStar = and(base('libp2p-webrtc-star'), WebSockets) var Reliable = or(TCP, UTP) var IPFS = and(Reliable, base('ipfs')) @@ -15,6 +16,7 @@ exports.TCP = TCP exports.UDP = UDP exports.UTP = UTP exports.WebSockets = WebSockets +exports.WebRTCStar = WebRTCStar exports.Reliable = Reliable exports.IPFS = IPFS diff --git a/test/index.spec.js b/test/index.spec.js index 782feb5..c1a5ad8 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -51,6 +51,11 @@ describe('multiaddr validation', function () { '/ip6/::/tcp/0/ws' ] + var goodWebRTCStar = [ + '/libp2p-webrtc-star/ip4/1.2.3.4/tcp/3456/ws', + '/libp2p-webrtc-star/ip6/::/tcp/0/ws' + ] + var badWS = [ '/ip4/0.0.0.0/tcp/12345/udp/2222/ws', '/ip6/::/ip4/0.0.0.0/udp/1234/ws' @@ -91,5 +96,8 @@ describe('multiaddr validation', function () { assertMatches(mafmt.WebSockets, goodWS) assertMismatches(mafmt.WebSockets, goodIP, goodUDP, badWS) + + assertMatches(mafmt.WebRTCStar, goodWebRTCStar) + assertMismatches(mafmt.WebRTCStar, goodIP, goodUDP, badWS) }) })