@libp2p/interface-internal 2.3.19-6059227cb → 2.3.19-87bc8d4fb
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents
|
|
1
|
+
import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents } from '@libp2p/interface';
|
|
2
2
|
import type { PeerMap } from '@libp2p/peer-collections';
|
|
3
3
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
4
4
|
import type { ProgressOptions } from 'progress-events';
|
|
@@ -73,21 +73,6 @@ export interface ConnectionManager {
|
|
|
73
73
|
* @returns A promise that resolves to a `Connection` object.
|
|
74
74
|
*/
|
|
75
75
|
openConnection(peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions): Promise<Connection>;
|
|
76
|
-
/**
|
|
77
|
-
* Open a protocol stream with a remote peer. If the peer is already connected
|
|
78
|
-
* an existing connection will be used to open the stream, otherwise they will
|
|
79
|
-
* be dialed first.
|
|
80
|
-
*
|
|
81
|
-
* This is preferable to opening a connection manually as it allows libp2p to
|
|
82
|
-
* decide what the "best" connection is, and in future, migrate streams across
|
|
83
|
-
* connections as better connections become available.
|
|
84
|
-
*
|
|
85
|
-
* @param peer - The target `PeerId`, `Multiaddr`, or an array of `Multiaddr`s.
|
|
86
|
-
* @param protocol - The protocol string or strings
|
|
87
|
-
* @param options - Optional parameters for connection handling.
|
|
88
|
-
* @returns A promise that resolves to a `Connection` object.
|
|
89
|
-
*/
|
|
90
|
-
openStream(peer: PeerId | Multiaddr | Multiaddr[], protocol: string | string[], options?: OpenConnectionOptions & NewStreamOptions): Promise<Stream>;
|
|
91
76
|
/**
|
|
92
77
|
* Close our connections to a peer
|
|
93
78
|
*
|
|
@@ -103,9 +88,9 @@ export interface ConnectionManager {
|
|
|
103
88
|
* otherwise it will return false.
|
|
104
89
|
*
|
|
105
90
|
* @param maConn - The multiaddr connection to evaluate.
|
|
106
|
-
* @returns `true` if the connection can be accepted, `false` otherwise.
|
|
91
|
+
* @returns A promise that resolves to `true` if the connection can be accepted, `false` otherwise.
|
|
107
92
|
*/
|
|
108
|
-
acceptIncomingConnection(maConn: MultiaddrConnection): boolean
|
|
93
|
+
acceptIncomingConnection(maConn: MultiaddrConnection): Promise<boolean>;
|
|
109
94
|
/**
|
|
110
95
|
* Invoked after upgrading an inbound multiaddr connection has finished
|
|
111
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../src/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../src/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAC5J,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY,EAAE,eAAe,CAAC,4BAA4B,CAAC;IACxG;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAAA;IAE7C;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAE1C;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM,CAAA;IAE3B;;;;OAIG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE5G;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE;;;;;;;;OAQG;IACH,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEvE;;OAEG;IACH,mBAAmB,IAAI,IAAI,CAAA;IAE3B;;;;OAIG;IACH,YAAY,IAAI,WAAW,EAAE,CAAA;IAE7B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9F"}
|
package/dist/src/registrar.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology,
|
|
1
|
+
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, IncomingStreamData } from '@libp2p/interface';
|
|
2
|
+
import type { AbortOptions } from '@multiformats/multiaddr';
|
|
3
|
+
export type {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
6
|
+
*/
|
|
7
|
+
IncomingStreamData,
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
10
|
+
*/
|
|
11
|
+
StreamHandler,
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
14
|
+
*/
|
|
15
|
+
StreamHandlerOptions,
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
18
|
+
*/
|
|
19
|
+
StreamHandlerRecord };
|
|
2
20
|
/**
|
|
3
21
|
* The `Registrar` provides an interface for registering protocol handlers -
|
|
4
22
|
* these are invoked when remote peers open streams on the local node with the
|
|
@@ -41,27 +59,6 @@ export interface Registrar {
|
|
|
41
59
|
* @returns A `StreamHandlerRecord` containing the handler and options.
|
|
42
60
|
*/
|
|
43
61
|
getHandler(protocol: string): StreamHandlerRecord;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieve any registered middleware for a given protocol.
|
|
46
|
-
*
|
|
47
|
-
* @param protocol - The protocol to fetch middleware for
|
|
48
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
49
|
-
*/
|
|
50
|
-
use(protocol: string, middleware: StreamMiddleware[]): void;
|
|
51
|
-
/**
|
|
52
|
-
* Retrieve any registered middleware for a given protocol.
|
|
53
|
-
*
|
|
54
|
-
* @param protocol - The protocol to fetch middleware for
|
|
55
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
56
|
-
*/
|
|
57
|
-
unuse(protocol: string): void;
|
|
58
|
-
/**
|
|
59
|
-
* Retrieve any registered middleware for a given protocol.
|
|
60
|
-
*
|
|
61
|
-
* @param protocol - The protocol to fetch middleware for
|
|
62
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
63
|
-
*/
|
|
64
|
-
getMiddleware(protocol: string): StreamMiddleware[];
|
|
65
62
|
/**
|
|
66
63
|
* Register a topology handler for a protocol - the topology will be
|
|
67
64
|
* invoked when peers are discovered on the network that support the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/registrar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/registrar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC/H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,YAAY;AACV;;GAEG;AACH,kBAAkB;AAElB;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,mBAAmB,EACpB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,YAAY,IAAI,MAAM,EAAE,CAAA;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/F;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;IAEjD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvF;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CAC5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface-internal",
|
|
3
|
-
"version": "2.3.19-
|
|
3
|
+
"version": "2.3.19-87bc8d4fb",
|
|
4
4
|
"description": "Interfaces implemented by internal libp2p components",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface-internal#readme",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"build": "aegir build"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@libp2p/interface": "2.11.0-
|
|
45
|
-
"@libp2p/peer-collections": "6.0.35-
|
|
46
|
-
"@multiformats/multiaddr": "^
|
|
44
|
+
"@libp2p/interface": "2.11.0-87bc8d4fb",
|
|
45
|
+
"@libp2p/peer-collections": "6.0.35-87bc8d4fb",
|
|
46
|
+
"@multiformats/multiaddr": "^12.4.4",
|
|
47
47
|
"progress-events": "^1.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"aegir": "^47.0.
|
|
50
|
+
"aegir": "^47.0.14"
|
|
51
51
|
},
|
|
52
52
|
"sideEffects": false
|
|
53
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents
|
|
1
|
+
import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents } from '@libp2p/interface'
|
|
2
2
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
3
3
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
4
4
|
import type { ProgressOptions } from 'progress-events'
|
|
@@ -82,22 +82,6 @@ export interface ConnectionManager {
|
|
|
82
82
|
*/
|
|
83
83
|
openConnection(peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions): Promise<Connection>
|
|
84
84
|
|
|
85
|
-
/**
|
|
86
|
-
* Open a protocol stream with a remote peer. If the peer is already connected
|
|
87
|
-
* an existing connection will be used to open the stream, otherwise they will
|
|
88
|
-
* be dialed first.
|
|
89
|
-
*
|
|
90
|
-
* This is preferable to opening a connection manually as it allows libp2p to
|
|
91
|
-
* decide what the "best" connection is, and in future, migrate streams across
|
|
92
|
-
* connections as better connections become available.
|
|
93
|
-
*
|
|
94
|
-
* @param peer - The target `PeerId`, `Multiaddr`, or an array of `Multiaddr`s.
|
|
95
|
-
* @param protocol - The protocol string or strings
|
|
96
|
-
* @param options - Optional parameters for connection handling.
|
|
97
|
-
* @returns A promise that resolves to a `Connection` object.
|
|
98
|
-
*/
|
|
99
|
-
openStream(peer: PeerId | Multiaddr | Multiaddr[], protocol: string | string[], options?: OpenConnectionOptions & NewStreamOptions): Promise<Stream>
|
|
100
|
-
|
|
101
85
|
/**
|
|
102
86
|
* Close our connections to a peer
|
|
103
87
|
*
|
|
@@ -114,9 +98,9 @@ export interface ConnectionManager {
|
|
|
114
98
|
* otherwise it will return false.
|
|
115
99
|
*
|
|
116
100
|
* @param maConn - The multiaddr connection to evaluate.
|
|
117
|
-
* @returns `true` if the connection can be accepted, `false` otherwise.
|
|
101
|
+
* @returns A promise that resolves to `true` if the connection can be accepted, `false` otherwise.
|
|
118
102
|
*/
|
|
119
|
-
acceptIncomingConnection(maConn: MultiaddrConnection): boolean
|
|
103
|
+
acceptIncomingConnection(maConn: MultiaddrConnection): Promise<boolean>
|
|
120
104
|
|
|
121
105
|
/**
|
|
122
106
|
* Invoked after upgrading an inbound multiaddr connection has finished
|
package/src/registrar.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology,
|
|
1
|
+
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, IncomingStreamData } from '@libp2p/interface'
|
|
2
|
+
import type { AbortOptions } from '@multiformats/multiaddr'
|
|
3
|
+
|
|
4
|
+
export type {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
7
|
+
*/
|
|
8
|
+
IncomingStreamData,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
12
|
+
*/
|
|
13
|
+
StreamHandler,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
17
|
+
*/
|
|
18
|
+
StreamHandlerOptions,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated This type should be imported from @libp2p/interface directly
|
|
22
|
+
*/
|
|
23
|
+
StreamHandlerRecord
|
|
24
|
+
}
|
|
2
25
|
|
|
3
26
|
/**
|
|
4
27
|
* The `Registrar` provides an interface for registering protocol handlers -
|
|
@@ -46,30 +69,6 @@ export interface Registrar {
|
|
|
46
69
|
*/
|
|
47
70
|
getHandler(protocol: string): StreamHandlerRecord
|
|
48
71
|
|
|
49
|
-
/**
|
|
50
|
-
* Retrieve any registered middleware for a given protocol.
|
|
51
|
-
*
|
|
52
|
-
* @param protocol - The protocol to fetch middleware for
|
|
53
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
54
|
-
*/
|
|
55
|
-
use(protocol: string, middleware: StreamMiddleware[]): void
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Retrieve any registered middleware for a given protocol.
|
|
59
|
-
*
|
|
60
|
-
* @param protocol - The protocol to fetch middleware for
|
|
61
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
62
|
-
*/
|
|
63
|
-
unuse(protocol: string): void
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Retrieve any registered middleware for a given protocol.
|
|
67
|
-
*
|
|
68
|
-
* @param protocol - The protocol to fetch middleware for
|
|
69
|
-
* @returns A list of `StreamMiddleware` implementations
|
|
70
|
-
*/
|
|
71
|
-
getMiddleware(protocol: string): StreamMiddleware[]
|
|
72
|
-
|
|
73
72
|
/**
|
|
74
73
|
* Register a topology handler for a protocol - the topology will be
|
|
75
74
|
* invoked when peers are discovered on the network that support the
|