mirror of
https://github.com/fluencelabs/js-mafmt
synced 2025-04-25 22:42:34 +00:00
feat: adding support for ports in resolvable addresses
This commit is contained in:
parent
95c5922596
commit
a1f9ccd457
@ -7,7 +7,7 @@ const multiaddr = require('multiaddr')
|
|||||||
*/
|
*/
|
||||||
const DNS4 = base('dns4')
|
const DNS4 = base('dns4')
|
||||||
const DNS6 = base('dns6')
|
const DNS6 = base('dns6')
|
||||||
const DNS = or(
|
const _DNS = or(
|
||||||
base('dns'),
|
base('dns'),
|
||||||
DNS4,
|
DNS4,
|
||||||
DNS6
|
DNS6
|
||||||
@ -18,6 +18,11 @@ const TCP = and(IP, base('tcp'))
|
|||||||
const UDP = and(IP, base('udp'))
|
const UDP = and(IP, base('udp'))
|
||||||
const UTP = and(UDP, base('utp'))
|
const UTP = and(UDP, base('utp'))
|
||||||
|
|
||||||
|
const DNS = or(
|
||||||
|
and(_DNS, base('tcp')),
|
||||||
|
_DNS
|
||||||
|
)
|
||||||
|
|
||||||
const WebSockets = or(
|
const WebSockets = or(
|
||||||
and(TCP, base('ws')),
|
and(TCP, base('ws')),
|
||||||
and(DNS, base('ws'))
|
and(DNS, base('ws'))
|
||||||
|
@ -10,7 +10,10 @@ describe('multiaddr validation', function () {
|
|||||||
'/dns/ipfs.io',
|
'/dns/ipfs.io',
|
||||||
'/dns4/ipfs.io',
|
'/dns4/ipfs.io',
|
||||||
'/dns4/libp2p.io',
|
'/dns4/libp2p.io',
|
||||||
'/dns6/protocol.ai'
|
'/dns6/protocol.ai',
|
||||||
|
'/dns4/protocol.ai/tcp/80',
|
||||||
|
'/dns6/protocol.ai/tcp/80',
|
||||||
|
'/dns/protocol.ai/tcp/80'
|
||||||
]
|
]
|
||||||
|
|
||||||
const badDNS = [
|
const badDNS = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user