@libp2p/interface 0.0.1-05abd49f

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.
Files changed (129) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +45 -0
  3. package/dist/index.min.js +3 -0
  4. package/dist/src/connection/index.d.ts +188 -0
  5. package/dist/src/connection/index.d.ts.map +1 -0
  6. package/dist/src/connection/index.js +5 -0
  7. package/dist/src/connection/index.js.map +1 -0
  8. package/dist/src/connection/status.d.ts +4 -0
  9. package/dist/src/connection/status.d.ts.map +1 -0
  10. package/dist/src/connection/status.js +4 -0
  11. package/dist/src/connection/status.js.map +1 -0
  12. package/dist/src/connection-encrypter/index.d.ts +27 -0
  13. package/dist/src/connection-encrypter/index.d.ts.map +1 -0
  14. package/dist/src/connection-encrypter/index.js +2 -0
  15. package/dist/src/connection-encrypter/index.js.map +1 -0
  16. package/dist/src/connection-gater/index.d.ts +117 -0
  17. package/dist/src/connection-gater/index.d.ts.map +1 -0
  18. package/dist/src/connection-gater/index.js +2 -0
  19. package/dist/src/connection-gater/index.js.map +1 -0
  20. package/dist/src/content-routing/index.d.ts +79 -0
  21. package/dist/src/content-routing/index.d.ts.map +1 -0
  22. package/dist/src/content-routing/index.js +21 -0
  23. package/dist/src/content-routing/index.js.map +1 -0
  24. package/dist/src/errors.d.ts +33 -0
  25. package/dist/src/errors.d.ts.map +1 -0
  26. package/dist/src/errors.js +51 -0
  27. package/dist/src/errors.js.map +1 -0
  28. package/dist/src/events.d.ts +28 -0
  29. package/dist/src/events.d.ts.map +1 -0
  30. package/dist/src/events.js +70 -0
  31. package/dist/src/events.js.map +1 -0
  32. package/dist/src/index.d.ts +575 -0
  33. package/dist/src/index.d.ts.map +1 -0
  34. package/dist/src/index.js +17 -0
  35. package/dist/src/index.js.map +1 -0
  36. package/dist/src/keychain/index.d.ts +154 -0
  37. package/dist/src/keychain/index.d.ts.map +1 -0
  38. package/dist/src/keychain/index.js +23 -0
  39. package/dist/src/keychain/index.js.map +1 -0
  40. package/dist/src/keys/index.d.ts +35 -0
  41. package/dist/src/keys/index.d.ts.map +1 -0
  42. package/dist/src/keys/index.js +4 -0
  43. package/dist/src/keys/index.js.map +1 -0
  44. package/dist/src/metrics/index.d.ts +165 -0
  45. package/dist/src/metrics/index.d.ts.map +1 -0
  46. package/dist/src/metrics/index.js +2 -0
  47. package/dist/src/metrics/index.js.map +1 -0
  48. package/dist/src/metrics/tracked-map.d.ts +17 -0
  49. package/dist/src/metrics/tracked-map.d.ts.map +1 -0
  50. package/dist/src/metrics/tracked-map.js +38 -0
  51. package/dist/src/metrics/tracked-map.js.map +1 -0
  52. package/dist/src/peer-discovery/index.d.ts +28 -0
  53. package/dist/src/peer-discovery/index.d.ts.map +1 -0
  54. package/dist/src/peer-discovery/index.js +21 -0
  55. package/dist/src/peer-discovery/index.js.map +1 -0
  56. package/dist/src/peer-id/index.d.ts +30 -0
  57. package/dist/src/peer-id/index.d.ts.map +1 -0
  58. package/dist/src/peer-id/index.js +5 -0
  59. package/dist/src/peer-id/index.js.map +1 -0
  60. package/dist/src/peer-info/index.d.ts +8 -0
  61. package/dist/src/peer-info/index.d.ts.map +1 -0
  62. package/dist/src/peer-info/index.js +2 -0
  63. package/dist/src/peer-info/index.js.map +1 -0
  64. package/dist/src/peer-routing/index.d.ts +51 -0
  65. package/dist/src/peer-routing/index.d.ts.map +1 -0
  66. package/dist/src/peer-routing/index.js +21 -0
  67. package/dist/src/peer-routing/index.js.map +1 -0
  68. package/dist/src/peer-store/index.d.ts +247 -0
  69. package/dist/src/peer-store/index.d.ts.map +1 -0
  70. package/dist/src/peer-store/index.js +2 -0
  71. package/dist/src/peer-store/index.js.map +1 -0
  72. package/dist/src/peer-store/tags.d.ts +2 -0
  73. package/dist/src/peer-store/tags.d.ts.map +1 -0
  74. package/dist/src/peer-store/tags.js +2 -0
  75. package/dist/src/peer-store/tags.js.map +1 -0
  76. package/dist/src/record/index.d.ts +33 -0
  77. package/dist/src/record/index.d.ts.map +1 -0
  78. package/dist/src/record/index.js +2 -0
  79. package/dist/src/record/index.js.map +1 -0
  80. package/dist/src/startable.d.ts +46 -0
  81. package/dist/src/startable.d.ts.map +1 -0
  82. package/dist/src/startable.js +46 -0
  83. package/dist/src/startable.js.map +1 -0
  84. package/dist/src/stream-handler/index.d.ts +23 -0
  85. package/dist/src/stream-handler/index.d.ts.map +1 -0
  86. package/dist/src/stream-handler/index.js +2 -0
  87. package/dist/src/stream-handler/index.js.map +1 -0
  88. package/dist/src/stream-muxer/index.d.ts +51 -0
  89. package/dist/src/stream-muxer/index.d.ts.map +1 -0
  90. package/dist/src/stream-muxer/index.js +2 -0
  91. package/dist/src/stream-muxer/index.js.map +1 -0
  92. package/dist/src/stream-muxer/stream.d.ts +85 -0
  93. package/dist/src/stream-muxer/stream.d.ts.map +1 -0
  94. package/dist/src/stream-muxer/stream.js +255 -0
  95. package/dist/src/stream-muxer/stream.js.map +1 -0
  96. package/dist/src/topology/index.d.ts +9 -0
  97. package/dist/src/topology/index.d.ts.map +1 -0
  98. package/dist/src/topology/index.js +2 -0
  99. package/dist/src/topology/index.js.map +1 -0
  100. package/dist/src/transport/index.d.ts +96 -0
  101. package/dist/src/transport/index.d.ts.map +1 -0
  102. package/dist/src/transport/index.js +19 -0
  103. package/dist/src/transport/index.js.map +1 -0
  104. package/package.json +177 -0
  105. package/src/connection/index.ts +221 -0
  106. package/src/connection/status.ts +4 -0
  107. package/src/connection-encrypter/index.ts +30 -0
  108. package/src/connection-gater/index.ts +128 -0
  109. package/src/content-routing/index.ts +83 -0
  110. package/src/errors.ts +68 -0
  111. package/src/events.ts +100 -0
  112. package/src/index.ts +627 -0
  113. package/src/keychain/index.ts +167 -0
  114. package/src/keys/index.ts +38 -0
  115. package/src/metrics/index.ts +187 -0
  116. package/src/metrics/tracked-map.ts +65 -0
  117. package/src/peer-discovery/index.ts +29 -0
  118. package/src/peer-id/index.ts +39 -0
  119. package/src/peer-info/index.ts +8 -0
  120. package/src/peer-routing/index.ts +53 -0
  121. package/src/peer-store/index.ts +272 -0
  122. package/src/peer-store/tags.ts +2 -0
  123. package/src/record/index.ts +35 -0
  124. package/src/startable.ts +117 -0
  125. package/src/stream-handler/index.ts +27 -0
  126. package/src/stream-muxer/index.ts +58 -0
  127. package/src/stream-muxer/stream.ts +365 -0
  128. package/src/topology/index.ts +10 -0
  129. package/src/transport/index.ts +111 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Exports a `Libp2p` type for modules to use as a type argument.
5
+ *
6
+ * @example
7
+ *
8
+ * ```typescript
9
+ * import type { Libp2p } from '@libp2p/interface'
10
+ *
11
+ * function doSomethingWithLibp2p (node: Libp2p) {
12
+ * // ...
13
+ * }
14
+ * ```
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * The libp2p keychain provides an API to store keys in a datastore in
5
+ * an encrypted format.
6
+ *
7
+ * @example
8
+ *
9
+ * ```typescript
10
+ * import { createLibp2p } from 'libp2p'
11
+ * import { FsDatastore } from 'datastore-fs'
12
+ *
13
+ * const node = await createLibp2p({
14
+ * datastore: new FsDatastore('/path/to/dir')
15
+ * })
16
+ *
17
+ * const info = await node.keychain.createKey('my-new-key', 'Ed25519')
18
+ *
19
+ * console.info(info) // { id: '...', name: 'my-new-key' }
20
+ * ```
21
+ */
22
+ import type { KeyType } from '../keys/index.js';
23
+ import type { PeerId } from '../peer-id/index.js';
24
+ import type { Multibase } from 'multiformats/bases/interface';
25
+ export interface KeyInfo {
26
+ /**
27
+ * The universally unique key id
28
+ */
29
+ id: string;
30
+ /**
31
+ * The local key name
32
+ */
33
+ name: string;
34
+ }
35
+ export interface KeyChain {
36
+ /**
37
+ * Export an existing key as a PEM encrypted PKCS #8 string.
38
+ *
39
+ * @example
40
+ *
41
+ * ```js
42
+ * await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
43
+ * const pemKey = await libp2p.keychain.exportKey('keyTest', 'password123')
44
+ * ```
45
+ */
46
+ exportKey: (name: string, password: string) => Promise<Multibase<'m'>>;
47
+ /**
48
+ * Import a new key from a PEM encoded PKCS #8 string.
49
+ *
50
+ * @example
51
+ *
52
+ * ```js
53
+ * await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
54
+ * const pemKey = await libp2p.keychain.exportKey('keyTest', 'password123')
55
+ * const keyInfo = await libp2p.keychain.importKey('keyTestImport', pemKey, 'password123')
56
+ * ```
57
+ */
58
+ importKey: (name: string, pem: string, password: string) => Promise<KeyInfo>;
59
+ /**
60
+ * Import a new key from a PeerId with a private key component
61
+ *
62
+ * @example
63
+ *
64
+ * ```js
65
+ * const keyInfo = await libp2p.keychain.importPeer('keyTestImport', peerIdFromString('12D3Foo...'))
66
+ * ```
67
+ */
68
+ importPeer: (name: string, peerId: PeerId) => Promise<KeyInfo>;
69
+ /**
70
+ * Export an existing key as a PeerId
71
+ *
72
+ * @example
73
+ *
74
+ * ```js
75
+ * const peerId = await libp2p.keychain.exportPeerId('key-name')
76
+ * ```
77
+ */
78
+ exportPeerId: (name: string) => Promise<PeerId>;
79
+ /**
80
+ * Create a key in the keychain.
81
+ *
82
+ * @example
83
+ *
84
+ * ```js
85
+ * const keyInfo = await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
86
+ * ```
87
+ */
88
+ createKey: (name: string, type: KeyType, size?: number) => Promise<KeyInfo>;
89
+ /**
90
+ * List all the keys.
91
+ *
92
+ * @example
93
+ *
94
+ * ```js
95
+ * const keyInfos = await libp2p.keychain.listKeys()
96
+ * ```
97
+ */
98
+ listKeys: () => Promise<KeyInfo[]>;
99
+ /**
100
+ * Removes a key from the keychain.
101
+ *
102
+ * @example
103
+ *
104
+ * ```js
105
+ * await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
106
+ * const keyInfo = await libp2p.keychain.removeKey('keyTest')
107
+ * ```
108
+ */
109
+ removeKey: (name: string) => Promise<KeyInfo>;
110
+ /**
111
+ * Rename a key in the keychain.
112
+ *
113
+ * @example
114
+ *
115
+ * ```js
116
+ * await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
117
+ * const keyInfo = await libp2p.keychain.renameKey('keyTest', 'keyNewNtest')
118
+ * ```
119
+ */
120
+ renameKey: (oldName: string, newName: string) => Promise<KeyInfo>;
121
+ /**
122
+ * Find a key by it's id.
123
+ *
124
+ * @example
125
+ *
126
+ * ```js
127
+ * const keyInfo = await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
128
+ * const keyInfo2 = await libp2p.keychain.findKeyById(keyInfo.id)
129
+ * ```
130
+ */
131
+ findKeyById: (id: string) => Promise<KeyInfo>;
132
+ /**
133
+ * Find a key by it's name.
134
+ *
135
+ * @example
136
+ *
137
+ * ```js
138
+ * const keyInfo = await libp2p.keychain.createKey('keyTest', 'RSA', 4096)
139
+ * const keyInfo2 = await libp2p.keychain.findKeyByName('keyTest')
140
+ * ```
141
+ */
142
+ findKeyByName: (name: string) => Promise<KeyInfo>;
143
+ /**
144
+ * Rotate keychain password and re-encrypt all associated keys
145
+ *
146
+ * @example
147
+ *
148
+ * ```js
149
+ * await libp2p.keychain.rotateKeychainPass('oldPassword', 'newPassword')
150
+ * ```
151
+ */
152
+ rotateKeychainPass: (oldPass: string, newPass: string) => Promise<void>;
153
+ }
154
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/keychain/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAA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,CAAA;IAE7C;;;;;;;;;OASG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAEjD;;;;;;;;OAQG;IACH,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACxE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * The libp2p keychain provides an API to store keys in a datastore in
5
+ * an encrypted format.
6
+ *
7
+ * @example
8
+ *
9
+ * ```typescript
10
+ * import { createLibp2p } from 'libp2p'
11
+ * import { FsDatastore } from 'datastore-fs'
12
+ *
13
+ * const node = await createLibp2p({
14
+ * datastore: new FsDatastore('/path/to/dir')
15
+ * })
16
+ *
17
+ * const info = await node.keychain.createKey('my-new-key', 'Ed25519')
18
+ *
19
+ * console.info(info) // { id: '...', name: 'my-new-key' }
20
+ * ```
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keychain/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
@@ -0,0 +1,35 @@
1
+ export interface PublicKey {
2
+ readonly bytes: Uint8Array;
3
+ verify: (data: Uint8Array, sig: Uint8Array) => Promise<boolean>;
4
+ marshal: () => Uint8Array;
5
+ equals: (key: PublicKey) => boolean;
6
+ hash: () => Promise<Uint8Array>;
7
+ }
8
+ /**
9
+ * Generic private key interface
10
+ */
11
+ export interface PrivateKey {
12
+ readonly public: PublicKey;
13
+ readonly bytes: Uint8Array;
14
+ sign: (data: Uint8Array) => Promise<Uint8Array>;
15
+ marshal: () => Uint8Array;
16
+ equals: (key: PrivateKey) => boolean;
17
+ hash: () => Promise<Uint8Array>;
18
+ /**
19
+ * Gets the ID of the key.
20
+ *
21
+ * The key id is the base58 encoding of the SHA-256 multihash of its public key.
22
+ * The public key is a protobuf encoding containing a type and the DER encoding
23
+ * of the PKCS SubjectPublicKeyInfo.
24
+ */
25
+ id: () => Promise<string>;
26
+ /**
27
+ * Exports the password protected key in the format specified.
28
+ */
29
+ export: (password: string, format?: 'pkcs-8' | string) => Promise<string>;
30
+ }
31
+ export declare const Ed25519 = "Ed25519";
32
+ export declare const RSA = "RSA";
33
+ export declare const secp256k1 = "secp256k1";
34
+ export type KeyType = typeof Ed25519 | typeof RSA | typeof secp256k1;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/keys/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,OAAO,EAAE,MAAM,UAAU,CAAA;IACzB,MAAM,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAA;IACnC,IAAI,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,UAAU,CAAA;IACzB,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAA;IACpC,IAAI,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;IAC/B;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IACzB;;OAEG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1E;AAED,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,GAAG,QAAQ,CAAA;AACxB,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO,GAAG,GAAG,OAAO,SAAS,CAAA"}
@@ -0,0 +1,4 @@
1
+ export const Ed25519 = 'Ed25519';
2
+ export const RSA = 'RSA';
3
+ export const secp256k1 = 'secp256k1';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keys/index.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAA;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAA;AACxB,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA"}
@@ -0,0 +1,165 @@
1
+ import type { MultiaddrConnection, Stream, Connection } from '../connection/index.js';
2
+ /**
3
+ * Create tracked metrics with these options. Loosely based on the
4
+ * interfaces exposed by the prom-client module
5
+ */
6
+ export interface MetricOptions {
7
+ /**
8
+ * Optional label for the metric
9
+ */
10
+ label?: string;
11
+ /**
12
+ * Optional help for the metric
13
+ */
14
+ help?: string;
15
+ }
16
+ /**
17
+ * A function that returns a tracked metric which may be expensive
18
+ * to calculate so it is only invoked when metrics are being scraped
19
+ */
20
+ export type CalculateMetric<T = number> = (() => T) | (() => Promise<T>);
21
+ /**
22
+ * Create tracked metrics that are expensive to calculate by passing
23
+ * a function that is only invoked when metrics are being scraped
24
+ */
25
+ export interface CalculatedMetricOptions<T = number> extends MetricOptions {
26
+ /**
27
+ * An optional function invoked to calculate the component metric instead of
28
+ * using `.update`, `.increment`, and `.decrement`
29
+ */
30
+ calculate: CalculateMetric<T>;
31
+ }
32
+ /**
33
+ * Call this function to stop the timer returned from the `.timer` method
34
+ * on the metric
35
+ */
36
+ export interface StopTimer {
37
+ (): void;
38
+ }
39
+ /**
40
+ * A tracked metric loosely based on the interfaces exposed by the
41
+ * prom-client module
42
+ */
43
+ export interface Metric {
44
+ /**
45
+ * Update the stored metric to the passed value
46
+ */
47
+ update: (value: number) => void;
48
+ /**
49
+ * Increment the metric by the passed value or 1
50
+ */
51
+ increment: (value?: number) => void;
52
+ /**
53
+ * Decrement the metric by the passed value or 1
54
+ */
55
+ decrement: (value?: number) => void;
56
+ /**
57
+ * Reset this metric to its default value
58
+ */
59
+ reset: () => void;
60
+ /**
61
+ * Start a timed metric, call the returned function to
62
+ * stop the timer
63
+ */
64
+ timer: () => StopTimer;
65
+ }
66
+ /**
67
+ * A group of related metrics loosely based on the interfaces exposed by the
68
+ * prom-client module
69
+ */
70
+ export interface MetricGroup {
71
+ /**
72
+ * Update the stored metric group to the passed value
73
+ */
74
+ update: (values: Record<string, number>) => void;
75
+ /**
76
+ * Increment the metric group keys by the passed number or
77
+ * any non-numeric value to increment by 1
78
+ */
79
+ increment: (values: Record<string, number | unknown>) => void;
80
+ /**
81
+ * Decrement the metric group keys by the passed number or
82
+ * any non-numeric value to decrement by 1
83
+ */
84
+ decrement: (values: Record<string, number | unknown>) => void;
85
+ /**
86
+ * Reset the passed key in this metric group to its default value
87
+ * or all keys if no key is passed
88
+ */
89
+ reset: () => void;
90
+ /**
91
+ * Start a timed metric for the named key in the group, call
92
+ * the returned function to stop the timer
93
+ */
94
+ timer: (key: string) => StopTimer;
95
+ }
96
+ /**
97
+ * A tracked counter loosely based on the Counter interface exposed
98
+ * by the prom-client module - counters are metrics that only go up
99
+ */
100
+ export interface Counter {
101
+ /**
102
+ * Increment the metric by the passed value or 1
103
+ */
104
+ increment: (value?: number) => void;
105
+ /**
106
+ * Reset this metric to its default value
107
+ */
108
+ reset: () => void;
109
+ }
110
+ /**
111
+ * A group of tracked counters loosely based on the Counter interface
112
+ * exposed by the prom-client module - counters are metrics that only
113
+ * go up
114
+ */
115
+ export interface CounterGroup {
116
+ /**
117
+ * Increment the metric group keys by the passed number or
118
+ * any non-numeric value to increment by 1
119
+ */
120
+ increment: (values: Record<string, number | unknown>) => void;
121
+ /**
122
+ * Reset the passed key in this metric group to its default value
123
+ * or all keys if no key is passed
124
+ */
125
+ reset: () => void;
126
+ }
127
+ /**
128
+ * The libp2p metrics tracking object. This interface is only concerned
129
+ * with the collection of metrics, please see the individual implementations
130
+ * for how to extract metrics for viewing.
131
+ */
132
+ export interface Metrics {
133
+ /**
134
+ * Track a newly opened multiaddr connection
135
+ */
136
+ trackMultiaddrConnection: (maConn: MultiaddrConnection) => void;
137
+ /**
138
+ * Track a newly opened protocol stream
139
+ */
140
+ trackProtocolStream: (stream: Stream, connection: Connection) => void;
141
+ /**
142
+ * Register an arbitrary metric. Call this to set help/labels for metrics
143
+ * and update/increment/decrement/etc them by calling methods on the returned
144
+ * metric object
145
+ */
146
+ registerMetric: ((name: string, options?: MetricOptions) => Metric) & ((name: string, options: CalculatedMetricOptions) => void);
147
+ /**
148
+ * Register a a group of related metrics. Call this to set help/labels for
149
+ * groups of related metrics that will be updated with by calling `.update`,
150
+ * `.increment` and/or `.decrement` methods on the returned metric group object
151
+ */
152
+ registerMetricGroup: ((name: string, options?: MetricOptions) => MetricGroup) & ((name: string, options: CalculatedMetricOptions<Record<string, number>>) => void);
153
+ /**
154
+ * Register an arbitrary counter. Call this to set help/labels for counters
155
+ * and increment them by calling methods on the returned counter object
156
+ */
157
+ registerCounter: ((name: string, options?: MetricOptions) => Counter) & ((name: string, options: CalculatedMetricOptions) => void);
158
+ /**
159
+ * Register a a group of related counters. Call this to set help/labels for
160
+ * groups of related counters that will be updated with by calling the `.increment`
161
+ * method on the returned counter group object
162
+ */
163
+ registerCounterGroup: ((name: string, options?: MetricOptions) => CounterGroup) & ((name: string, options: CalculatedMetricOptions<Record<string, number>>) => void);
164
+ }
165
+ //# sourceMappingURL=index.d.ts.map
@@ -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C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;IAElK;;;OAGG;IACH,eAAe,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC,CAAA;IAElI;;;;OAIG;IACH,oBAAoB,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;CACrK"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metrics/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { Metrics } from './index.js';
2
+ export interface TrackedMapInit {
3
+ name: string;
4
+ metrics: Metrics;
5
+ }
6
+ export interface CreateTrackedMapInit {
7
+ /**
8
+ * The metric name to use
9
+ */
10
+ name: string;
11
+ /**
12
+ * A metrics implementation
13
+ */
14
+ metrics?: Metrics;
15
+ }
16
+ export declare function trackedMap<K, V>(config: CreateTrackedMapInit): Map<K, V>;
17
+ //# sourceMappingURL=tracked-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB;AAoCD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,UAAU,CAAE,CAAC,EAAE,CAAC,EAAG,MAAM,EAAE,oBAAoB,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAW1E"}
@@ -0,0 +1,38 @@
1
+ class TrackedMap extends Map {
2
+ metric;
3
+ constructor(init) {
4
+ super();
5
+ const { name, metrics } = init;
6
+ this.metric = metrics.registerMetric(name);
7
+ this.updateComponentMetric();
8
+ }
9
+ set(key, value) {
10
+ super.set(key, value);
11
+ this.updateComponentMetric();
12
+ return this;
13
+ }
14
+ delete(key) {
15
+ const deleted = super.delete(key);
16
+ this.updateComponentMetric();
17
+ return deleted;
18
+ }
19
+ clear() {
20
+ super.clear();
21
+ this.updateComponentMetric();
22
+ }
23
+ updateComponentMetric() {
24
+ this.metric.update(this.size);
25
+ }
26
+ }
27
+ export function trackedMap(config) {
28
+ const { name, metrics } = config;
29
+ let map;
30
+ if (metrics != null) {
31
+ map = new TrackedMap({ name, metrics });
32
+ }
33
+ else {
34
+ map = new Map();
35
+ }
36
+ return map;
37
+ }
38
+ //# sourceMappingURL=tracked-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracked-map.js","sourceRoot":"","sources":["../../../src/metrics/tracked-map.ts"],"names":[],"mappings":"AAOA,MAAM,UAAiB,SAAQ,GAAS;IACrB,MAAM,CAAQ;IAE/B,YAAa,IAAoB;QAC/B,KAAK,EAAE,CAAA;QAEP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAE9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,GAAG,CAAE,GAAM,EAAE,KAAQ;QACnB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACrB,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAE,GAAM;QACZ,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAEO,qBAAqB;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;CACF;AAcD,MAAM,UAAU,UAAU,CAAS,MAA4B;IAC7D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAChC,IAAI,GAAc,CAAA;IAElB,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,GAAG,GAAG,IAAI,UAAU,CAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;KAC9C;SAAM;QACL,GAAG,GAAG,IAAI,GAAG,EAAQ,CAAA;KACtB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { EventEmitter } from '../events.js';
2
+ import type { PeerInfo } from '../peer-info/index.js';
3
+ /**
4
+ * Any object that implements this Symbol as a property should return a
5
+ * PeerDiscovery instance as the property value, similar to how
6
+ * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
7
+ *
8
+ * @example
9
+ *
10
+ * ```js
11
+ * import { peerDiscovery, PeerDiscovery } from '@libp2p/peer-discovery'
12
+ *
13
+ * class MyPeerDiscoverer implements PeerDiscovery {
14
+ * get [peerDiscovery] () {
15
+ * return this
16
+ * }
17
+ *
18
+ * // ...other methods
19
+ * }
20
+ * ```
21
+ */
22
+ export declare const peerDiscovery: unique symbol;
23
+ export interface PeerDiscoveryEvents {
24
+ 'peer': CustomEvent<PeerInfo>;
25
+ }
26
+ export interface PeerDiscovery extends EventEmitter<PeerDiscoveryEvents> {
27
+ }
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-discovery/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,eAAuC,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;CAC9B;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC,mBAAmB,CAAC;CAAG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Any object that implements this Symbol as a property should return a
3
+ * PeerDiscovery instance as the property value, similar to how
4
+ * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
5
+ *
6
+ * @example
7
+ *
8
+ * ```js
9
+ * import { peerDiscovery, PeerDiscovery } from '@libp2p/peer-discovery'
10
+ *
11
+ * class MyPeerDiscoverer implements PeerDiscovery {
12
+ * get [peerDiscovery] () {
13
+ * return this
14
+ * }
15
+ *
16
+ * // ...other methods
17
+ * }
18
+ * ```
19
+ */
20
+ export const peerDiscovery = Symbol.for('@libp2p/peer-discovery');
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-discovery/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { CID } from 'multiformats/cid';
2
+ import type { MultihashDigest } from 'multiformats/hashes/interface';
3
+ export type PeerIdType = 'RSA' | 'Ed25519' | 'secp256k1';
4
+ interface BasePeerId {
5
+ readonly type: PeerIdType;
6
+ readonly multihash: MultihashDigest;
7
+ readonly privateKey?: Uint8Array;
8
+ readonly publicKey?: Uint8Array;
9
+ toString: () => string;
10
+ toCID: () => CID;
11
+ toBytes: () => Uint8Array;
12
+ equals: (other: PeerId | Uint8Array | string) => boolean;
13
+ }
14
+ export interface RSAPeerId extends BasePeerId {
15
+ readonly type: 'RSA';
16
+ readonly publicKey?: Uint8Array;
17
+ }
18
+ export interface Ed25519PeerId extends BasePeerId {
19
+ readonly type: 'Ed25519';
20
+ readonly publicKey: Uint8Array;
21
+ }
22
+ export interface Secp256k1PeerId extends BasePeerId {
23
+ readonly type: 'secp256k1';
24
+ readonly publicKey: Uint8Array;
25
+ }
26
+ export type PeerId = RSAPeerId | Ed25519PeerId | Secp256k1PeerId;
27
+ export declare const symbol: unique symbol;
28
+ export declare function isPeerId(other: any): other is PeerId;
29
+ export {};
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW,CAAA;AAExD,UAAU,UAAU;IAClB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;IAE/B,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,CAAA;IAChB,OAAO,EAAE,MAAM,UAAU,CAAA;IACzB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,KAAK,OAAO,CAAA;CACzD;AAED,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,eAAe,CAAA;AAEhE,eAAO,MAAM,MAAM,eAAgC,CAAA;AAEnD,wBAAgB,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAErD"}
@@ -0,0 +1,5 @@
1
+ export const symbol = Symbol.for('@libp2p/peer-id');
2
+ export function isPeerId(other) {
3
+ return other != null && Boolean(other[symbol]);
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAEnD,MAAM,UAAU,QAAQ,CAAE,KAAU;IAClC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;AAChD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { PeerId } from '../peer-id/index.js';
2
+ import type { Multiaddr } from '@multiformats/multiaddr';
3
+ export interface PeerInfo {
4
+ id: PeerId;
5
+ multiaddrs: Multiaddr[];
6
+ protocols: string[];
7
+ }
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-info/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-info/index.ts"],"names":[],"mappings":""}