multiaddr-to-uri
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -6,3 +6,7 @@ const Multiaddr = require('multiaddr') | ||
ip4: reduceValue, | ||
ip6: reduceValue, | ||
ip6: (str, content, i, parts) => ( | ||
parts.length === 1 && parts[0].protocol === 'ip6' | ||
? content | ||
: `[${content}]` | ||
), | ||
tcp: (str, content, i, parts) => ( | ||
@@ -9,0 +13,0 @@ parts.some(p => ['http', 'https', 'ws', 'wss'].includes(p.protocol)) |
{ | ||
"name": "multiaddr-to-uri", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> http://ipfs.io", | ||
@@ -19,8 +19,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"nyc": "^12.0.2", | ||
"standard": "^11.0.1" | ||
"ava": "^1.1.0", | ||
"nyc": "^13.1.0", | ||
"standard": "^12.0.1" | ||
}, | ||
"dependencies": { | ||
"multiaddr": "^5.0.0" | ||
"multiaddr": "^6.0.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "repository": { |
20
test.js
@@ -9,7 +9,9 @@ const test = require('ava') | ||
['/ip6/fc00::', 'fc00::'], | ||
['/ip6/fc00::/http', 'http://fc00::'], | ||
['/ip6/fc00::/http', 'http://[fc00::]'], | ||
['/ip4/0.0.7.6/tcp/1234', 'tcp://0.0.7.6:1234'], | ||
['/ip6/::/tcp/0', 'tcp://:::0'], | ||
['/ip4/0.0.7.6/tcp/1234/http', 'http://0.0.7.6:1234'], | ||
['/ip4/0.0.7.6/tcp/1234/https', 'https://0.0.7.6:1234'], | ||
['/ip6/::/tcp/0', 'tcp://[::]:0'], | ||
['/ip4/0.0.7.6/udp/1234', 'udp://0.0.7.6:1234'], | ||
['/ip6/::/udp/0', 'udp://:::0'], | ||
['/ip6/::/udp/0', 'udp://[::]:0'], | ||
['/dnsaddr/ipfs.io', 'ipfs.io'], | ||
@@ -22,2 +24,4 @@ ['/dns4/ipfs.io', 'ipfs.io'], | ||
['/dnsaddr/protocol.ai/tcp/80', 'tcp://protocol.ai:80'], | ||
['/dnsaddr/protocol.ai/tcp/80/http', 'http://protocol.ai:80'], | ||
['/dnsaddr/protocol.ai/tcp/80/https', 'https://protocol.ai:80'], | ||
['/dnsaddr/ipfs.io/ws', 'ws://ipfs.io'], | ||
@@ -27,6 +31,6 @@ ['/dnsaddr/ipfs.io/http', 'http://ipfs.io'], | ||
['/ip4/1.2.3.4/tcp/3456/ws', 'ws://1.2.3.4:3456'], | ||
['/ip6/::/tcp/0/ws', 'ws://:::0'], | ||
['/ip6/::/tcp/0/ws', 'ws://[::]:0'], | ||
['/dnsaddr/ipfs.io/wss', 'wss://ipfs.io'], | ||
['/ip4/1.2.3.4/tcp/3456/wss', 'wss://1.2.3.4:3456'], | ||
['/ip6/::/tcp/0/wss', 'wss://:::0'], | ||
['/ip6/::/tcp/0/wss', 'wss://[::]:0'], | ||
[ | ||
@@ -46,3 +50,3 @@ '/ip4/1.2.3.4/tcp/3456/ws/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo', | ||
'/ip6/::/tcp/0/ws/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo5', | ||
'ws://:::0/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo5' | ||
'ws://[::]:0/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo5' | ||
], | ||
@@ -54,5 +58,5 @@ [ | ||
['/ip4/1.2.3.4/tcp/3456/http/p2p-webrtc-direct', 'http://1.2.3.4:3456/p2p-webrtc-direct'], | ||
['/ip6/::/tcp/0/http/p2p-webrtc-direct', 'http://:::0/p2p-webrtc-direct'], | ||
['/ip6/::/tcp/0/http/p2p-webrtc-direct', 'http://[::]:0/p2p-webrtc-direct'], | ||
['/ip4/1.2.3.4/tcp/3456/ws/p2p-websocket-star', 'ws://1.2.3.4:3456/p2p-websocket-star'], | ||
['/ip6/::/tcp/0/ws/p2p-websocket-star', 'ws://:::0/p2p-websocket-star'], | ||
['/ip6/::/tcp/0/ws/p2p-websocket-star', 'ws://[::]:0/p2p-websocket-star'], | ||
[ | ||
@@ -59,0 +63,0 @@ '/dnsaddr/localhost/ws/p2p-websocket-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8546
126
+ Addedhi-base32@0.5.1(transitive)
+ Addedip-regex@2.1.0(transitive)
+ Addedis-ip@2.0.0(transitive)
+ Addedmultiaddr@6.1.1(transitive)
- Removedip-address@5.9.4(transitive)
- Removedjsbn@1.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.filter@4.6.0(transitive)
- Removedlodash.map@4.6.0(transitive)
- Removedmultiaddr@5.0.2(transitive)
- Removedsprintf-js@1.1.2(transitive)
- Removedxtend@4.0.2(transitive)
Updatedmultiaddr@^6.0.3