@libp2p/perf 1.1.12 → 1.1.13-50442d7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -18
- package/package.json +9 -9
- package/dist/typedoc-urls.json +0 -12
package/README.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# @libp2p/perf <!-- omit in toc -->
|
2
|
-
|
3
1
|
[](http://libp2p.io/)
|
4
2
|
[](https://discuss.libp2p.io)
|
5
3
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
@@ -7,39 +5,58 @@
|
|
7
5
|
|
8
6
|
> Implementation of Perf Protocol
|
9
7
|
|
10
|
-
|
8
|
+
# About
|
9
|
+
|
10
|
+
The `performanceService` implements the [perf protocol](https://github.com/libp2p/specs/blob/master/perf/perf.md), which is used to measure performance within and across libp2p implementations
|
11
|
+
addresses.
|
11
12
|
|
12
|
-
|
13
|
-
- [Browser `<script>` tag](#browser-script-tag)
|
14
|
-
- [API Docs](#api-docs)
|
15
|
-
- [License](#license)
|
16
|
-
- [Contribution](#contribution)
|
13
|
+
## Example
|
17
14
|
|
18
|
-
|
15
|
+
```typescript
|
16
|
+
import { createLibp2p } from 'libp2p'
|
17
|
+
import { perfService } from '@libp2p/perf'
|
19
18
|
|
20
|
-
|
21
|
-
|
19
|
+
const node = await createLibp2p({
|
20
|
+
service: [
|
21
|
+
perfService()
|
22
|
+
]
|
23
|
+
})
|
22
24
|
```
|
23
25
|
|
24
|
-
|
26
|
+
The `measurePerformance` function can be used to measure the latency and throughput of a connection.
|
27
|
+
server. This will not work in browsers.
|
28
|
+
|
29
|
+
## Example
|
30
|
+
|
31
|
+
```typescript
|
32
|
+
import { createLibp2p } from 'libp2p'
|
33
|
+
import { perfService } from 'libp2p/perf'
|
34
|
+
|
35
|
+
const node = await createLibp2p({
|
36
|
+
services: [
|
37
|
+
perf: perfService()
|
38
|
+
]
|
39
|
+
})
|
40
|
+
|
41
|
+
const connection = await node.dial(multiaddr(multiaddrAddress))
|
42
|
+
|
43
|
+
const startTime = Date.now()
|
25
44
|
|
26
|
-
|
45
|
+
await node.services.perf.measurePerformance(startTime, connection, BigInt(uploadBytes), BigInt(downloadBytes))
|
27
46
|
|
28
|
-
```html
|
29
|
-
<script src="https://unpkg.com/@libp2p/perf/dist/index.min.js"></script>
|
30
47
|
```
|
31
48
|
|
32
|
-
|
49
|
+
# API Docs
|
33
50
|
|
34
51
|
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_perf.html>
|
35
52
|
|
36
|
-
|
53
|
+
# License
|
37
54
|
|
38
55
|
Licensed under either of
|
39
56
|
|
40
57
|
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
41
58
|
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
42
59
|
|
43
|
-
|
60
|
+
# Contribution
|
44
61
|
|
45
62
|
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.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/perf",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.13-50442d7a",
|
4
4
|
"description": "Implementation of Perf Protocol",
|
5
5
|
"author": "@maschad / @marcopolo",
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
@@ -50,16 +50,16 @@
|
|
50
50
|
"dependencies": {
|
51
51
|
"@chainsafe/libp2p-noise": "^13.0.0",
|
52
52
|
"@chainsafe/libp2p-yamux": "^5.0.0",
|
53
|
-
"@libp2p/crypto": "
|
54
|
-
"@libp2p/interface": "
|
55
|
-
"@libp2p/interface-compliance-tests": "
|
56
|
-
"@libp2p/interface-internal": "
|
53
|
+
"@libp2p/crypto": "2.0.6-50442d7a",
|
54
|
+
"@libp2p/interface": "0.1.4-50442d7a",
|
55
|
+
"@libp2p/interface-compliance-tests": "4.1.2-50442d7a",
|
56
|
+
"@libp2p/interface-internal": "0.1.7-50442d7a",
|
57
57
|
"@libp2p/interfaces": "3.3.2",
|
58
|
-
"@libp2p/logger": "
|
59
|
-
"@libp2p/peer-id-factory": "
|
60
|
-
"@libp2p/tcp": "
|
58
|
+
"@libp2p/logger": "3.0.4-50442d7a",
|
59
|
+
"@libp2p/peer-id-factory": "3.0.6-50442d7a",
|
60
|
+
"@libp2p/tcp": "8.0.10-50442d7a",
|
61
61
|
"@multiformats/multiaddr": "^12.1.5",
|
62
|
-
"libp2p": "
|
62
|
+
"libp2p": "0.46.16-50442d7a",
|
63
63
|
"uint8arrays": "^4.0.6",
|
64
64
|
"yargs": "^17.7.2"
|
65
65
|
},
|
package/dist/typedoc-urls.json
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"PerfService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfService.html",
|
3
|
-
".:PerfService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfService.html",
|
4
|
-
"PerfServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfServiceComponents.html",
|
5
|
-
".:PerfServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfServiceComponents.html",
|
6
|
-
"PerfServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfServiceInit.html",
|
7
|
-
".:PerfServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_perf.PerfServiceInit.html",
|
8
|
-
"defaultInit": "https://libp2p.github.io/js-libp2p/variables/_libp2p_perf.defaultInit.html",
|
9
|
-
".:defaultInit": "https://libp2p.github.io/js-libp2p/variables/_libp2p_perf.defaultInit.html",
|
10
|
-
"perfService": "https://libp2p.github.io/js-libp2p/functions/_libp2p_perf.perfService-1.html",
|
11
|
-
".:perfService": "https://libp2p.github.io/js-libp2p/functions/_libp2p_perf.perfService-1.html"
|
12
|
-
}
|