@libp2p/utils 1.0.4 → 1.0.5
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/multiaddr/is-loopback.d.ts +1 -1
- package/dist/src/multiaddr/is-loopback.d.ts.map +1 -1
- package/dist/src/multiaddr/is-loopback.js +1 -2
- package/dist/src/multiaddr/is-loopback.js.map +1 -1
- package/dist/src/stream-to-ma-conn.d.ts +2 -2
- package/dist/src/stream-to-ma-conn.d.ts.map +1 -1
- package/dist/src/stream-to-ma-conn.js +3 -3
- package/dist/src/stream-to-ma-conn.js.map +1 -1
- package/package.json +6 -6
- package/src/multiaddr/is-loopback.ts +1 -2
- package/src/stream-to-ma-conn.ts +4 -4
|
@@ -2,5 +2,5 @@ import type { Multiaddr } from '@multiformats/multiaddr';
|
|
|
2
2
|
/**
|
|
3
3
|
* Check if a given multiaddr is a loopback address.
|
|
4
4
|
*/
|
|
5
|
-
export declare function isLoopback(ma: Multiaddr):
|
|
5
|
+
export declare function isLoopback(ma: Multiaddr): boolean;
|
|
6
6
|
//# sourceMappingURL=is-loopback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-loopback.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-loopback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-loopback.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-loopback.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD;;GAEG;AACH,wBAAgB,UAAU,CAAE,EAAE,EAAE,SAAS,WAIxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-loopback.js","sourceRoot":"","sources":["../../../src/multiaddr/is-loopback.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"is-loopback.js","sourceRoot":"","sources":["../../../src/multiaddr/is-loopback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAE,EAAa;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;IAEpC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -25,7 +25,7 @@ interface StreamOptions {
|
|
|
25
25
|
signal?: AbortSignal;
|
|
26
26
|
}
|
|
27
27
|
interface StreamProperties {
|
|
28
|
-
stream: MuxedStream
|
|
28
|
+
stream: MuxedStream;
|
|
29
29
|
remoteAddr: Multiaddr;
|
|
30
30
|
localAddr: Multiaddr;
|
|
31
31
|
}
|
|
@@ -33,6 +33,6 @@ interface StreamProperties {
|
|
|
33
33
|
* Convert a duplex iterable into a MultiaddrConnection.
|
|
34
34
|
* https://github.com/libp2p/interface-transport#multiaddrconnection
|
|
35
35
|
*/
|
|
36
|
-
export declare function streamToMaConnection(props: StreamProperties, options?: StreamOptions): MultiaddrConnection
|
|
36
|
+
export declare function streamToMaConnection(props: StreamProperties, options?: StreamOptions): MultiaddrConnection;
|
|
37
37
|
export {};
|
|
38
38
|
//# sourceMappingURL=stream-to-ma-conn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-to-ma-conn.d.ts","sourceRoot":"","sources":["../../src/stream-to-ma-conn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAIvE;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;CAErB;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"stream-to-ma-conn.d.ts","sourceRoot":"","sources":["../../src/stream-to-ma-conn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAIvE;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;CAErB;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,WAAW,CAAA;IACnB,UAAU,EAAE,SAAS,CAAA;IACrB,SAAS,EAAE,SAAS,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,GAAE,aAAkB,uBA4CzF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { abortableSource } from 'abortable-iterator';
|
|
2
2
|
import debug from 'debug';
|
|
3
3
|
const log = debug('libp2p:stream:converter');
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ export function streamToMaConnection(props, options = {}) {
|
|
|
11
11
|
const maConn = {
|
|
12
12
|
async sink(source) {
|
|
13
13
|
if (options.signal != null) {
|
|
14
|
-
source =
|
|
14
|
+
source = abortableSource(source, options.signal);
|
|
15
15
|
}
|
|
16
16
|
try {
|
|
17
17
|
await sink(source);
|
|
@@ -27,7 +27,7 @@ export function streamToMaConnection(props, options = {}) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
source: (options.signal != null) ?
|
|
30
|
+
source: (options.signal != null) ? abortableSource(source, options.signal) : source,
|
|
31
31
|
conn: stream,
|
|
32
32
|
localAddr,
|
|
33
33
|
remoteAddr,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-to-ma-conn.js","sourceRoot":"","sources":["../../src/stream-to-ma-conn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stream-to-ma-conn.js","sourceRoot":"","sources":["../../src/stream-to-ma-conn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,GAAG,GAAG,KAAK,CAAC,yBAAyB,CAAC,CAAA;AAqC5C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAE,KAAuB,EAAE,UAAyB,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAC/C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IAC/B,MAAM,MAAM,GAAwB;QAClC,KAAK,CAAC,IAAI,CAAE,MAAM;YAChB,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;gBAC1B,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;aACjD;YAED,IAAI;gBACF,MAAM,IAAI,CAAC,MAAM,CAAC,CAAA;gBAClB,MAAM,KAAK,EAAE,CAAA;aACd;YAAC,OAAO,GAAQ,EAAE;gBACjB,kCAAkC;gBAClC,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;oBAC1B,uEAAuE;oBACvE,gEAAgE;oBAChE,uEAAuE;oBACvE,GAAG,CAAC,GAAG,CAAC,CAAA;iBACT;aACF;QACH,CAAC;QACD,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM;QACnF,IAAI,EAAE,MAAM;QACZ,SAAS;QACT,UAAU;QACV,uBAAuB;QACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAChD,KAAK,CAAC,KAAK;YACT,MAAM,IAAI,CAAC,KAAK,SAAU,CAAC;gBACzB,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;YACzB,CAAC,EAAE,CAAC,CAAA;YACJ,MAAM,KAAK,EAAE,CAAA;QACf,CAAC;KACF,CAAA;IAED,KAAK,UAAU,KAAK;QAClB,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,EAAE;YACjC,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;SACnC;QACD,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;IAChC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-utils#readme",
|
|
@@ -172,18 +172,18 @@
|
|
|
172
172
|
"dependencies": {
|
|
173
173
|
"@achingbrain/ip-address": "^8.1.0",
|
|
174
174
|
"@multiformats/multiaddr": "^10.1.1",
|
|
175
|
-
"abortable-iterator": "^
|
|
175
|
+
"abortable-iterator": "^4.0.2",
|
|
176
176
|
"debug": "^4.3.0",
|
|
177
177
|
"err-code": "^3.0.1",
|
|
178
|
-
"is-loopback-addr": "^
|
|
178
|
+
"is-loopback-addr": "^2.0.1",
|
|
179
179
|
"private-ip": "^2.1.1"
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
|
-
"@libp2p/interfaces": "^0.
|
|
182
|
+
"@libp2p/interfaces": "^1.0.3",
|
|
183
183
|
"@types/debug": "^4.1.5",
|
|
184
184
|
"aegir": "^36.1.2",
|
|
185
|
-
"it-pair": "^
|
|
186
|
-
"it-pipe": "^
|
|
185
|
+
"it-pair": "^2.0.2",
|
|
186
|
+
"it-pipe": "^2.0.2",
|
|
187
187
|
"streaming-iterables": "^6.0.0",
|
|
188
188
|
"util": "^0.12.3"
|
|
189
189
|
}
|
package/src/stream-to-ma-conn.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { abortableSource } from 'abortable-iterator'
|
|
2
2
|
import debug from 'debug'
|
|
3
3
|
import type { MuxedStream } from '@libp2p/interfaces/stream-muxer'
|
|
4
4
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
@@ -36,7 +36,7 @@ interface StreamOptions {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
interface StreamProperties {
|
|
39
|
-
stream: MuxedStream
|
|
39
|
+
stream: MuxedStream
|
|
40
40
|
remoteAddr: Multiaddr
|
|
41
41
|
localAddr: Multiaddr
|
|
42
42
|
}
|
|
@@ -51,7 +51,7 @@ export function streamToMaConnection (props: StreamProperties, options: StreamOp
|
|
|
51
51
|
const maConn: MultiaddrConnection = {
|
|
52
52
|
async sink (source) {
|
|
53
53
|
if (options.signal != null) {
|
|
54
|
-
source =
|
|
54
|
+
source = abortableSource(source, options.signal)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
try {
|
|
@@ -67,7 +67,7 @@ export function streamToMaConnection (props: StreamProperties, options: StreamOp
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
source: (options.signal != null) ?
|
|
70
|
+
source: (options.signal != null) ? abortableSource(source, options.signal) : source,
|
|
71
71
|
conn: stream,
|
|
72
72
|
localAddr,
|
|
73
73
|
remoteAddr,
|