@libp2p/interface 1.5.0 → 1.6.0-151bc46fb

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.
@@ -14,6 +14,9 @@ export interface Secp256k1PeerId extends PeerId {
14
14
  readonly type: 'secp256k1';
15
15
  readonly publicKey: Uint8Array;
16
16
  }
17
+ export interface URLPeerId extends PeerId {
18
+ readonly type: 'url';
19
+ }
17
20
  export interface PeerId {
18
21
  type: PeerIdType;
19
22
  multihash: MultihashDigest;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAA;AAEzC,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,eAAe,CAAA;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,SAAS,CAAC,EAAE,UAAU,CAAA;IAEtB,QAAQ,IAAI,MAAM,CAAA;I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AM,CAAA;IAClB,KAAK,IAAI,GAAG,CAAA;IACZ,OAAO,IAAI,UAAU,CAAA;IACrB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAA;CACtD;AAED,eAAO,MAAM,YAAY,eAAgC,CAAA;AAEzD,wBAAgB,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAErD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAEzD,MAAM,UAAU,QAAQ,CAAE,KAAU;IAClC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;AACtD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAEzD,MAAM,UAAU,QAAQ,CAAE,KAAU;IAClC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;AACtD,CAAC"}
@@ -3,6 +3,7 @@ import type { TypedEventTarget } from '../event-target.js';
3
3
  import type { AbortOptions } from '../index.js';
4
4
  import type { StreamMuxerFactory } from '../stream-muxer/index.js';
5
5
  import type { Multiaddr } from '@multiformats/multiaddr';
6
+ import type { ProgressOptions, ProgressEvent } from 'progress-events';
6
7
  export interface ListenerEvents {
7
8
  'connection': CustomEvent<Connection>;
8
9
  'listening': CustomEvent;
@@ -36,13 +37,13 @@ export interface CreateListenerOptions {
36
37
  handler?: ConnectionHandler;
37
38
  upgrader: Upgrader;
38
39
  }
39
- export interface DialOptions extends AbortOptions {
40
+ export interface DialOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> {
40
41
  upgrader: Upgrader;
41
42
  }
42
43
  /**
43
- * A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
44
+ * A libp2p transport offers dial and listen methods to establish connections.
44
45
  */
45
- export interface Transport {
46
+ export interface Transport<DialEvents extends ProgressEvent = ProgressEvent> {
46
47
  /**
47
48
  * Used to identify the transport
48
49
  */
@@ -54,7 +55,7 @@ export interface Transport {
54
55
  /**
55
56
  * Dial a given multiaddr.
56
57
  */
57
- dial(ma: Multiaddr, options: DialOptions): Promise<Connection>;
58
+ dial(ma: Multiaddr, options: DialOptions<DialEvents>): Promise<Connection>;
58
59
  /**
59
60
  * Create transport listeners.
60
61
  */
@@ -84,7 +85,7 @@ export declare enum FaultTolerance {
84
85
  */
85
86
  NO_FATAL = 1
86
87
  }
87
- export interface UpgraderOptions {
88
+ export interface UpgraderOptions<ConnectionUpgradeEvents extends ProgressEvent = ProgressEvent> extends ProgressOptions<ConnectionUpgradeEvents> {
88
89
  skipEncryption?: boolean;
89
90
  skipProtection?: boolean;
90
91
  muxerFactory?: StreamMuxerFactory;
@@ -94,14 +95,16 @@ export interface UpgraderOptions {
94
95
  */
95
96
  transient?: boolean;
96
97
  }
98
+ export type InboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-inbound-connection'> | ProgressEvent<'upgrader:multiplex-inbound-connection'>;
99
+ export type OutboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-outbound-connection'> | ProgressEvent<'upgrader:multiplex-outbound-connection'>;
97
100
  export interface Upgrader {
98
101
  /**
99
102
  * Upgrades an outbound connection on `transport.dial`.
100
103
  */
101
- upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>;
104
+ upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>;
102
105
  /**
103
106
  * Upgrades an inbound connection on transport listener.
104
107
  */
105
- upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>;
108
+ upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection>;
106
109
  }
107
110
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACrC,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,QAAS,SAAQ,gBAAgB,CAAC,cAAc,CAAC;IAChE;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3C;;OAEG;IACH,QAAQ,IAAI,SAAS,EAAE,CAAA;IACvB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAED,eAAO,MAAM,eAAe,eAAkC,CAAA;AAE9D,MAAM,WAAW,iBAAiB;IAAG,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE;AAErE,MAAM,WAAW,eAAe;IAAG,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,C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D,aAAa,CAAC,wCAAwC,CAAC,CAAA;AAEvD,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,eAAe,CAAC,+BAA+B,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE1H;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,eAAe,CAAC,8BAA8B,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACzH"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/index.ts"],"names":[],"mappings":"AA8BA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAoD9D,MAAM,UAAU,WAAW,CAAE,KAAU;IACrC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/index.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAoD9D,MAAM,UAAU,WAAW,CAAE,KAAU;IACrC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface",
3
- "version": "1.5.0",
3
+ "version": "1.6.0-151bc46fb",
4
4
  "description": "The interface implemented by a libp2p node",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
@@ -19,6 +19,10 @@ export interface Secp256k1PeerId extends PeerId {
19
19
  readonly publicKey: Uint8Array
20
20
  }
21
21
 
22
+ export interface URLPeerId extends PeerId {
23
+ readonly type: 'url'
24
+ }
25
+
22
26
  export interface PeerId {
23
27
  type: PeerIdType
24
28
  multihash: MultihashDigest
@@ -3,6 +3,7 @@ import type { TypedEventTarget } from '../event-target.js'
3
3
  import type { AbortOptions } from '../index.js'
4
4
  import type { StreamMuxerFactory } from '../stream-muxer/index.js'
5
5
  import type { Multiaddr } from '@multiformats/multiaddr'
6
+ import type { ProgressOptions, ProgressEvent } from 'progress-events'
6
7
 
7
8
  export interface ListenerEvents {
8
9
  'connection': CustomEvent<Connection>
@@ -39,14 +40,14 @@ export interface CreateListenerOptions {
39
40
  upgrader: Upgrader
40
41
  }
41
42
 
42
- export interface DialOptions extends AbortOptions {
43
+ export interface DialOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> {
43
44
  upgrader: Upgrader
44
45
  }
45
46
 
46
47
  /**
47
- * A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
48
+ * A libp2p transport offers dial and listen methods to establish connections.
48
49
  */
49
- export interface Transport {
50
+ export interface Transport<DialEvents extends ProgressEvent = ProgressEvent> {
50
51
  /**
51
52
  * Used to identify the transport
52
53
  */
@@ -60,7 +61,7 @@ export interface Transport {
60
61
  /**
61
62
  * Dial a given multiaddr.
62
63
  */
63
- dial(ma: Multiaddr, options: DialOptions): Promise<Connection>
64
+ dial(ma: Multiaddr, options: DialOptions<DialEvents>): Promise<Connection>
64
65
 
65
66
  /**
66
67
  * Create transport listeners.
@@ -99,7 +100,7 @@ export enum FaultTolerance {
99
100
  NO_FATAL
100
101
  }
101
102
 
102
- export interface UpgraderOptions {
103
+ export interface UpgraderOptions<ConnectionUpgradeEvents extends ProgressEvent = ProgressEvent> extends ProgressOptions<ConnectionUpgradeEvents> {
103
104
  skipEncryption?: boolean
104
105
  skipProtection?: boolean
105
106
  muxerFactory?: StreamMuxerFactory
@@ -111,14 +112,22 @@ export interface UpgraderOptions {
111
112
  transient?: boolean
112
113
  }
113
114
 
115
+ export type InboundConnectionUpgradeEvents =
116
+ ProgressEvent<'upgrader:encrypt-inbound-connection'> |
117
+ ProgressEvent<'upgrader:multiplex-inbound-connection'>
118
+
119
+ export type OutboundConnectionUpgradeEvents =
120
+ ProgressEvent<'upgrader:encrypt-outbound-connection'> |
121
+ ProgressEvent<'upgrader:multiplex-outbound-connection'>
122
+
114
123
  export interface Upgrader {
115
124
  /**
116
125
  * Upgrades an outbound connection on `transport.dial`.
117
126
  */
118
- upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>
127
+ upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>
119
128
 
120
129
  /**
121
130
  * Upgrades an inbound connection on transport listener.
122
131
  */
123
- upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>
132
+ upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection>
124
133
  }
@@ -1,164 +0,0 @@
1
- {
2
- "KeyTypes": "https://libp2p.github.io/js-libp2p/types/_libp2p_crypto.keys.KeyTypes.html",
3
- "FaultTolerance": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.FaultTolerance.html",
4
- "TopicValidatorResult": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.TopicValidatorResult.html",
5
- "AbortError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AbortError.html",
6
- "AggregateCodeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AggregateCodeError.html",
7
- "CodeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.CodeError.html",
8
- "InvalidCryptoExchangeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCryptoExchangeError.html",
9
- "InvalidCryptoTransmissionError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCryptoTransmissionError.html",
10
- "TypedEventEmitter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TypedEventEmitter.html",
11
- "UnexpectedPeerError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnexpectedPeerError.html",
12
- "AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
13
- ".:AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
14
- "Address": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Address.html",
15
- "AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
16
- ".:AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
17
- "CalculatedMetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CalculatedMetricOptions.html",
18
- "ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
19
- ".:ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
20
- "Connection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Connection.html",
21
- "ConnectionEncrypter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionEncrypter.html",
22
- "ConnectionGater": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionGater.html",
23
- "ConnectionHandler": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionHandler.html",
24
- "ConnectionProtector": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionProtector.html",
25
- "ConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionTimeline.html",
26
- "ContentRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRouting.html",
27
- "ContentRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRoutingProvider.html",
28
- "Counter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Counter.html",
29
- "CounterGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CounterGroup.html",
30
- "CreateListenerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CreateListenerOptions.html",
31
- "DialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialOptions.html",
32
- "Ed25519PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Ed25519PeerId.html",
33
- "Envelope": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Envelope.html",
34
- "EventCallback": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventCallback.html",
35
- "EventObject": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventObject.html",
36
- "IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
37
- ".:IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
38
- "IncomingStreamData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IncomingStreamData.html",
39
- "IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
40
- ".:IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
41
- "Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2p.html",
42
- ".:Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2p.html",
43
- "Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
44
- ".:Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
45
- "Listener": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Listener.html",
46
- "ListenerEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ListenerEvents.html",
47
- "Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
48
- ".:Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
49
- "LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
50
- ".:LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
51
- "Metric": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metric.html",
52
- "MetricGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricGroup.html",
53
- "MetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricOptions.html",
54
- "Metrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metrics.html",
55
- "MultiaddrConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnection.html",
56
- "MultiaddrConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnectionTimeline.html",
57
- "MultiaddrFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrFilter.html",
58
- "NewStreamOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NewStreamOptions.html",
59
- "NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
60
- ".:NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
61
- "Peer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Peer.html",
62
- "PeerData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerData.html",
63
- "PeerDiscovery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscovery.html",
64
- "PeerDiscoveryEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryEvents.html",
65
- "PeerDiscoveryProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryProvider.html",
66
- "PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerId.html",
67
- "PeerInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerInfo.html",
68
- "PeerQuery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQuery.html",
69
- "PeerQueryFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryFilter.html",
70
- "PeerQueryOrder": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryOrder.html",
71
- "PeerRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRouting.html",
72
- "PeerRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRoutingProvider.html",
73
- "PeerStore": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStore.html",
74
- "PeerStreamEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreamEvents.html",
75
- "PeerStreams": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreams.html",
76
- "PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
77
- ".:PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
78
- "PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
79
- ".:PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
80
- "PrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PrivateKey.html",
81
- "PubSub": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSub.html",
82
- "PubSubEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubEvents.html",
83
- "PubSubInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubInit.html",
84
- "PubSubRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPC.html",
85
- "PubSubRPCMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCMessage.html",
86
- "PubSubRPCSubscription": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCSubscription.html",
87
- "PublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PublicKey.html",
88
- "PublishResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PublishResult.html",
89
- "RSAPeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RSAPeerId.html",
90
- "Record": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Record.html",
91
- "RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
92
- ".:RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
93
- "Secp256k1PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Secp256k1PeerId.html",
94
- "SecuredConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SecuredConnection.html",
95
- "SignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedMessage.html",
96
- "SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
97
- ".:SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
98
- "Startable": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Startable.html",
99
- "StopTimer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StopTimer.html",
100
- "Stream": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Stream.html",
101
- "StreamHandler": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandler.html",
102
- "StreamHandlerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerOptions.html",
103
- "StreamHandlerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerRecord.html",
104
- "StreamMuxer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxer.html",
105
- "StreamMuxerFactory": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerFactory.html",
106
- "StreamMuxerInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerInit.html",
107
- "StreamTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamTimeline.html",
108
- "SubscriptionChangeData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SubscriptionChangeData.html",
109
- "Tag": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Tag.html",
110
- "TagOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TagOptions.html",
111
- "TopicValidatorFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TopicValidatorFn.html",
112
- "Topology": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Topology.html",
113
- "TopologyFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TopologyFilter.html",
114
- "Transport": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Transport.html",
115
- "TypedEventTarget": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TypedEventTarget.html",
116
- "UnsignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UnsignedMessage.html",
117
- "Upgrader": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Upgrader.html",
118
- "UpgraderOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UpgraderOptions.html",
119
- "CalculateMetric": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.CalculateMetric.html",
120
- "ConnectionStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ConnectionStatus.html",
121
- "Direction": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Direction.html",
122
- "EventHandler": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.EventHandler.html",
123
- "KeyType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.KeyType.html",
124
- "Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
125
- ".:Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
126
- "Message": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Message.html",
127
- "PeerIdType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PeerIdType.html",
128
- "PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
129
- ".:PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
130
- "ReadStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ReadStatus.html",
131
- "ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
132
- ".:ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
133
- "SignaturePolicy": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.SignaturePolicy.html",
134
- "StreamStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.StreamStatus.html",
135
- "WriteStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.WriteStatus.html",
136
- "CustomEvent": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.CustomEvent.html",
137
- "ERR_INVALID_MESSAGE": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_INVALID_MESSAGE.html",
138
- "ERR_INVALID_PARAMETERS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_INVALID_PARAMETERS.html",
139
- "ERR_NOT_FOUND": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_NOT_FOUND.html",
140
- "ERR_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_TIMEOUT.html",
141
- "Ed25519": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.Ed25519.html",
142
- "KEEP_ALIVE": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.KEEP_ALIVE.html",
143
- "RSA": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.RSA.html",
144
- "StrictNoSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictNoSign.html",
145
- "StrictSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictSign.html",
146
- "connectionSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.connectionSymbol.html",
147
- "contentRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.contentRoutingSymbol.html",
148
- "peerDiscoverySymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerDiscoverySymbol.html",
149
- "peerIdSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerIdSymbol.html",
150
- "peerRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerRoutingSymbol.html",
151
- "secp256k1": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.secp256k1.html",
152
- "serviceCapabilities": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceCapabilities.html",
153
- ".:serviceCapabilities": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceCapabilities.html",
154
- "serviceDependencies": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceDependencies.html",
155
- ".:serviceDependencies": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceDependencies.html",
156
- "transportSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.transportSymbol.html",
157
- "isConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isConnection.html",
158
- "isPeerId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPeerId.html",
159
- "isStartable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isStartable.html",
160
- "isTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isTransport.html",
161
- "setMaxListeners": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.setMaxListeners.html",
162
- "start": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.start.html",
163
- "stop": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.stop.html"
164
- }