Installations
npm install mafmt
Developer
multiformats
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.3.0
NPM Version
7.15.1
Statistics
15 Stars
227 Commits
18 Forks
14 Watching
5 Branches
43 Contributors
Updated on 26 May 2023
Languages
TypeScript (99.47%)
JavaScript (0.53%)
Total Downloads
Cumulative downloads
Total Downloads
9,980,360
Last day
14.1%
4,775
Compared to previous day
Last week
13%
29,646
Compared to previous week
Last month
-6.5%
115,105
Compared to previous month
Last year
-38.7%
1,425,889
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
3
@multiformats/mafmt
A multiaddr validator
Table of contents
Install
1$ npm i @multiformats/mafmt
Browser <script>
tag
Loading this module through a script tag will make it's exports available as MultiformatsMafmt
in the global namespace.
1<script src="https://unpkg.com/@multiformats/mafmt/dist/index.min.js"></script>
Usage
1import * as mafmt from '@multiformats/mafmt' 2 3mafmt.DNS.matches('/dns4/ipfs.io') // true
API
mafmt.<FORMAT>.matches(multiaddr)
Where <FORMAT>
may be:
<FORMAT> | Description | Example(s) |
---|---|---|
DNS | a "dns4" or "dns6" format multiaddr | /dnsaddr/ipfs.io |
DNS4 | a "dns4" format multiaddr | /dns4/ipfs.io |
DNS6 | a "dns6" format multiaddr | /dns6/protocol.ai/tcp/80 |
IP | an "ip4" or "ip6" format multiaddr | /ip4/127.0.0.1 /ip6/fc00:: |
TCP | a "tcp" over IP format multiaddr | /ip4/0.0.7.6/tcp/1234 |
UDP | a "udp" over IP format multiaddr | /ip4/0.0.7.6/udp/1234 |
QUIC | a "quic" over UDP format multiaddr | /ip4/1.2.3.4/udp/1234/quic |
UTP | a "utp" over UDP format multiaddr | /ip4/1.2.3.4/udp/3456/utp |
Websockets | a "ws" over TCP or "ws" over DNS format multiaddr | /ip4/1.2.3.4/tcp/3456/ws /dnsaddr/ipfs.io/ws |
WebSocketsSecure | a "wss" over TCP or "wss" over DNS format multiaddr | /ip6/::/tcp/0/wss /dnsaddr/ipfs.io/wss |
HTTP | a "http" over TCP or DNS or "http" over DNS format multiaddr | /ip4/127.0.0.1/tcp/90/http /dnsaddr/ipfs.io/http |
HTTPS | a "https" over TCP or DNS or "https" over DNS format multiaddr | /ip4/127.0.0.1/tcp/90/https /dnsaddr/ipfs.io/https |
WebRTCStar | a "p2p" over "p2p-webrtc-star" over Websockets or "p2p" over "p2p-webrtc-star" over WebSocketsSecure format multiaddr | /dnsaddr/ipfs.io/wss/p2p-webrtc-star/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 |
WebSocketStar | a "p2p" over "p2p-websocket-star" over Websockets or "p2p" over "p2p-websocket-star" over WebSocketsSecure or "p2p-websocket-star" over Websockets or "p2p-websocket-star" over WebSocketsSecure format multiaddr | /ip4/1.2.3.4/tcp/3456/ws/p2p-websocket-star /dnsaddr/localhost/ws/p2p-websocket-star/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 |
WebRTCDirect | a "p2p-webrtc-direct" over HTTP or "p2p-webrtc-direct" over HTTPS format multiaddr | /ip4/1.2.3.4/tcp/3456/http/p2p-webrtc-direct |
Reliable | a WebSockets or WebSocketsSecure or HTTP or HTTPS or WebRTCStar or WebRTCDirect or TCP or UTP or QUIC format multiaddr | /dnsaddr/ipfs.io/wss |
Circuit | /p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj | |
P2P | "p2p", aka "ipfs", over Reliable or WebRTCStar or "p2p" format multiaddr | /p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 /ip4/127.0.0.1/tcp/20008/ws/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj |
Where multiaddr
may be:
- a Multiaddr
- a String
- a Uint8Array
Returns true
/false
API Docs
License
Licensed under either of
- Apache 2.0, (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)
- MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
Found 6/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: topLevel 'packages' permission set to 'write': .github/workflows/js-test-and-release.yml:13
- Warn: topLevel 'contents' permission set to 'write': .github/workflows/js-test-and-release.yml:11
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 17 are checked with a SAST tool
Score
3.8
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More