@libp2p/interface-internal 0.1.11-cf963694f → 0.1.11-e7167fe52
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/dist/src/registrar/index.d.ts +12 -0
- package/dist/src/registrar/index.d.ts.map +1 -1
- package/dist/src/transport-manager/index.d.ts +30 -0
- package/dist/src/transport-manager/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/registrar/index.ts +14 -0
- package/src/transport-manager/index.ts +38 -0
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { Connection, Stream, Topology } from '@libp2p/interface';
|
|
2
2
|
export interface IncomingStreamData {
|
|
3
|
+
/**
|
|
4
|
+
* The stream that has been opened
|
|
5
|
+
*/
|
|
3
6
|
stream: Stream;
|
|
7
|
+
/**
|
|
8
|
+
* The connection that the stream was opened on
|
|
9
|
+
*/
|
|
4
10
|
connection: Connection;
|
|
5
11
|
}
|
|
6
12
|
export interface StreamHandler {
|
|
@@ -23,7 +29,13 @@ export interface StreamHandlerOptions {
|
|
|
23
29
|
runOnTransientConnection?: boolean;
|
|
24
30
|
}
|
|
25
31
|
export interface StreamHandlerRecord {
|
|
32
|
+
/**
|
|
33
|
+
* The handler that was registered to handle streams opened on the protocol
|
|
34
|
+
*/
|
|
26
35
|
handler: StreamHandler;
|
|
36
|
+
/**
|
|
37
|
+
* The options that were used to register the stream handler
|
|
38
|
+
*/
|
|
27
39
|
options: StreamHandlerOptions;
|
|
28
40
|
}
|
|
29
41
|
export interface Registrar {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/registrar/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAErE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":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AAM,GAAG,QAAQ,EAAE,CAAA;CAC5C"}
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import type { Connection, Listener, Transport } from '@libp2p/interface';
|
|
2
2
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
3
3
|
export interface TransportManager {
|
|
4
|
+
/**
|
|
5
|
+
* Add a transport to the transport manager
|
|
6
|
+
*/
|
|
4
7
|
add(transport: Transport): void;
|
|
8
|
+
/**
|
|
9
|
+
* Dial a multiaddr. Connections returned by this method will not be tracked
|
|
10
|
+
* by the connection manager so can cause memory leaks. If you need to dial
|
|
11
|
+
* a multiaddr, you may want to call openConnection on the connection manager
|
|
12
|
+
* instead.
|
|
13
|
+
*/
|
|
5
14
|
dial(ma: Multiaddr, options?: any): Promise<Connection>;
|
|
15
|
+
/**
|
|
16
|
+
* Return all addresses currently being listened on
|
|
17
|
+
*/
|
|
6
18
|
getAddrs(): Multiaddr[];
|
|
19
|
+
/**
|
|
20
|
+
* Return all registered transports
|
|
21
|
+
*/
|
|
7
22
|
getTransports(): Transport[];
|
|
23
|
+
/**
|
|
24
|
+
* Return all listeners
|
|
25
|
+
*/
|
|
8
26
|
getListeners(): Listener[];
|
|
27
|
+
/**
|
|
28
|
+
* Get the transport for a given multiaddr, if one has been configured
|
|
29
|
+
*/
|
|
9
30
|
transportForMultiaddr(ma: Multiaddr): Transport | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Listen on the passed multiaddrs
|
|
33
|
+
*/
|
|
10
34
|
listen(addrs: Multiaddr[]): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Remove a previously configured transport
|
|
37
|
+
*/
|
|
11
38
|
remove(key: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Remove all transports
|
|
41
|
+
*/
|
|
12
42
|
removeAll(): Promise<void>;
|
|
13
43
|
}
|
|
14
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;IAE/B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAEvD;;OAEG;IACH,QAAQ,IAAI,SAAS,EAAE,CAAA;IAEvB;;OAEG;IACH,aAAa,IAAI,SAAS,EAAE,CAAA;IAE5B;;OAEG;IACH,YAAY,IAAI,QAAQ,EAAE,CAAA;IAE1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;IAE3D;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAElC;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface-internal",
|
|
3
|
-
"version": "0.1.11-
|
|
3
|
+
"version": "0.1.11-e7167fe52",
|
|
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",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"build": "aegir build"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@libp2p/interface": "1.0.1-
|
|
67
|
-
"@libp2p/peer-collections": "4.0.10-
|
|
66
|
+
"@libp2p/interface": "1.0.1-e7167fe52",
|
|
67
|
+
"@libp2p/peer-collections": "4.0.10-e7167fe52",
|
|
68
68
|
"@multiformats/multiaddr": "^12.1.10",
|
|
69
69
|
"uint8arraylist": "^2.4.3"
|
|
70
70
|
},
|
package/src/registrar/index.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { Connection, Stream, Topology } from '@libp2p/interface'
|
|
2
2
|
|
|
3
3
|
export interface IncomingStreamData {
|
|
4
|
+
/**
|
|
5
|
+
* The stream that has been opened
|
|
6
|
+
*/
|
|
4
7
|
stream: Stream
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The connection that the stream was opened on
|
|
11
|
+
*/
|
|
5
12
|
connection: Connection
|
|
6
13
|
}
|
|
7
14
|
|
|
@@ -29,7 +36,14 @@ export interface StreamHandlerOptions {
|
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
export interface StreamHandlerRecord {
|
|
39
|
+
/**
|
|
40
|
+
* The handler that was registered to handle streams opened on the protocol
|
|
41
|
+
*/
|
|
32
42
|
handler: StreamHandler
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The options that were used to register the stream handler
|
|
46
|
+
*/
|
|
33
47
|
options: StreamHandlerOptions
|
|
34
48
|
}
|
|
35
49
|
|
|
@@ -2,13 +2,51 @@ import type { Connection, Listener, Transport } from '@libp2p/interface'
|
|
|
2
2
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
3
3
|
|
|
4
4
|
export interface TransportManager {
|
|
5
|
+
/**
|
|
6
|
+
* Add a transport to the transport manager
|
|
7
|
+
*/
|
|
5
8
|
add(transport: Transport): void
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Dial a multiaddr. Connections returned by this method will not be tracked
|
|
12
|
+
* by the connection manager so can cause memory leaks. If you need to dial
|
|
13
|
+
* a multiaddr, you may want to call openConnection on the connection manager
|
|
14
|
+
* instead.
|
|
15
|
+
*/
|
|
6
16
|
dial(ma: Multiaddr, options?: any): Promise<Connection>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Return all addresses currently being listened on
|
|
20
|
+
*/
|
|
7
21
|
getAddrs(): Multiaddr[]
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Return all registered transports
|
|
25
|
+
*/
|
|
8
26
|
getTransports(): Transport[]
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Return all listeners
|
|
30
|
+
*/
|
|
9
31
|
getListeners(): Listener[]
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the transport for a given multiaddr, if one has been configured
|
|
35
|
+
*/
|
|
10
36
|
transportForMultiaddr(ma: Multiaddr): Transport | undefined
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Listen on the passed multiaddrs
|
|
40
|
+
*/
|
|
11
41
|
listen(addrs: Multiaddr[]): Promise<void>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Remove a previously configured transport
|
|
45
|
+
*/
|
|
12
46
|
remove(key: string): Promise<void>
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Remove all transports
|
|
50
|
+
*/
|
|
13
51
|
removeAll(): Promise<void>
|
|
14
52
|
}
|