libp2p 1.9.0 → 1.9.1-3c8dd5bbf
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/index.min.js +6 -6
- package/dist/src/connection-monitor.d.ts +7 -0
- package/dist/src/connection-monitor.d.ts.map +1 -1
- package/dist/src/connection-monitor.js +6 -1
- package/dist/src/connection-monitor.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +18 -18
- package/src/connection-monitor.ts +13 -1
- package/src/version.ts +1 -1
- package/dist/typedoc-urls.json +0 -14
|
@@ -29,6 +29,12 @@ export interface ConnectionMonitorInit {
|
|
|
29
29
|
* @default true
|
|
30
30
|
*/
|
|
31
31
|
abortConnectionOnPingFailure?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Override the ping protocol prefix
|
|
34
|
+
*
|
|
35
|
+
* @default 'ipfs'
|
|
36
|
+
*/
|
|
37
|
+
protocolPrefix?: string;
|
|
32
38
|
}
|
|
33
39
|
export interface ConnectionMonitorComponents {
|
|
34
40
|
logger: ComponentLogger;
|
|
@@ -36,6 +42,7 @@ export interface ConnectionMonitorComponents {
|
|
|
36
42
|
metrics?: Metrics;
|
|
37
43
|
}
|
|
38
44
|
export declare class ConnectionMonitor implements Startable {
|
|
45
|
+
private readonly protocol;
|
|
39
46
|
private readonly components;
|
|
40
47
|
private readonly log;
|
|
41
48
|
private heartbeatInterval?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-monitor.d.ts","sourceRoot":"","sources":["../../src/connection-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAU,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACpF,OAAO,KAAK,EAAE,iBAAiB,E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BAE5B,UAAU,EAAE,2BAA2B,EAAE,IAAI,GAAE,qBAA0B;IActF,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,gCAA+B;IAE5D,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAEvC;IAED,KAAK,IAAK,IAAI;IAoDd,IAAI,IAAK,IAAI;CAOd"}
|
|
@@ -2,7 +2,11 @@ import { serviceCapabilities } from '@libp2p/interface';
|
|
|
2
2
|
import { AdaptiveTimeout } from '@libp2p/utils/adaptive-timeout';
|
|
3
3
|
import { byteStream } from 'it-byte-stream';
|
|
4
4
|
const DEFAULT_PING_INTERVAL_MS = 10000;
|
|
5
|
+
const PROTOCOL_VERSION = '1.0.0';
|
|
6
|
+
const PROTOCOL_NAME = 'ping';
|
|
7
|
+
const PROTOCOL_PREFIX = 'ipfs';
|
|
5
8
|
export class ConnectionMonitor {
|
|
9
|
+
protocol;
|
|
6
10
|
components;
|
|
7
11
|
log;
|
|
8
12
|
heartbeatInterval;
|
|
@@ -11,6 +15,7 @@ export class ConnectionMonitor {
|
|
|
11
15
|
timeout;
|
|
12
16
|
constructor(components, init = {}) {
|
|
13
17
|
this.components = components;
|
|
18
|
+
this.protocol = `/${init.protocolPrefix ?? PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`;
|
|
14
19
|
this.log = components.logger.forComponent('libp2p:connection-monitor');
|
|
15
20
|
this.pingIntervalMs = init.pingInterval ?? DEFAULT_PING_INTERVAL_MS;
|
|
16
21
|
this.timeout = new AdaptiveTimeout({
|
|
@@ -33,7 +38,7 @@ export class ConnectionMonitor {
|
|
|
33
38
|
const signal = this.timeout.getTimeoutSignal({
|
|
34
39
|
signal: this.abortController?.signal
|
|
35
40
|
});
|
|
36
|
-
const stream = await conn.newStream(
|
|
41
|
+
const stream = await conn.newStream(this.protocol, {
|
|
37
42
|
signal,
|
|
38
43
|
runOnTransientConnection: true
|
|
39
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-monitor.js","sourceRoot":"","sources":["../../src/connection-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAK3C,MAAM,wBAAwB,GAAG,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"connection-monitor.js","sourceRoot":"","sources":["../../src/connection-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAK3C,MAAM,wBAAwB,GAAG,KAAK,CAAA;AACtC,MAAM,gBAAgB,GAAG,OAAO,CAAA;AAChC,MAAM,aAAa,GAAG,MAAM,CAAA;AAC5B,MAAM,eAAe,GAAG,MAAM,CAAA;AA+C9B,MAAM,OAAO,iBAAiB;IACX,QAAQ,CAAQ;IAChB,UAAU,CAA6B;IACvC,GAAG,CAAQ;IACpB,iBAAiB,CAAiC;IACzC,cAAc,CAAQ;IAC/B,eAAe,CAAkB;IACxB,OAAO,CAAiB;IAEzC,YAAa,UAAuC,EAAE,OAA8B,EAAE;QACpF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,cAAc,IAAI,eAAe,IAAI,aAAa,IAAI,gBAAgB,EAAE,CAAA;QAEjG,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAA;QACtE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,YAAY,IAAI,wBAAwB,CAAA;QAEnE,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAA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,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAA;wBAE7B,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC;4BACtB,MAAM;yBACP,CAAC,CAAA;oBACJ,CAAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBAClB,IAAI,GAAG,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;4BAC5C,MAAM,GAAG,CAAA;wBACX,CAAC;wBAED,iEAAiE;wBACjE,kEAAkE;wBAClE,gEAAgE;wBAChE,8CAA8C;wBAC9C,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;oBACrC,CAAC;gBACH,CAAC,CAAC;qBACC,KAAK,CAAC,GAAG,CAAC,EAAE;oBACX,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6CAA6C,EAAE,GAAG,CAAC,CAAA;oBAClE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBACjB,CAAC,CAAC,CAAA;YACN,CAAC,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;IACzB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,CAAA;QAE7B,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC;YACnC,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CACF"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA;AACxC,eAAO,MAAM,IAAI,WAAW,CAAA"}
|
package/dist/src/version.js
CHANGED
package/dist/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA;AACxC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1-3c8dd5bbf",
|
|
4
4
|
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/libp2p#readme",
|
|
@@ -85,16 +85,16 @@
|
|
|
85
85
|
"test:webkit": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser webkit"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@libp2p/crypto": "
|
|
89
|
-
"@libp2p/interface": "
|
|
90
|
-
"@libp2p/interface-internal": "
|
|
91
|
-
"@libp2p/logger": "
|
|
92
|
-
"@libp2p/multistream-select": "
|
|
93
|
-
"@libp2p/peer-collections": "
|
|
94
|
-
"@libp2p/peer-id": "
|
|
95
|
-
"@libp2p/peer-id-factory": "
|
|
96
|
-
"@libp2p/peer-store": "
|
|
97
|
-
"@libp2p/utils": "
|
|
88
|
+
"@libp2p/crypto": "4.1.9-3c8dd5bbf",
|
|
89
|
+
"@libp2p/interface": "1.7.0-3c8dd5bbf",
|
|
90
|
+
"@libp2p/interface-internal": "1.3.4-3c8dd5bbf",
|
|
91
|
+
"@libp2p/logger": "4.0.20-3c8dd5bbf",
|
|
92
|
+
"@libp2p/multistream-select": "5.1.17-3c8dd5bbf",
|
|
93
|
+
"@libp2p/peer-collections": "5.2.9-3c8dd5bbf",
|
|
94
|
+
"@libp2p/peer-id": "4.2.4-3c8dd5bbf",
|
|
95
|
+
"@libp2p/peer-id-factory": "4.2.4-3c8dd5bbf",
|
|
96
|
+
"@libp2p/peer-store": "10.1.5-3c8dd5bbf",
|
|
97
|
+
"@libp2p/utils": "5.4.9-3c8dd5bbf",
|
|
98
98
|
"@multiformats/dns": "^1.0.6",
|
|
99
99
|
"@multiformats/multiaddr": "^12.2.3",
|
|
100
100
|
"@multiformats/multiaddr-matcher": "^1.2.1",
|
|
@@ -114,13 +114,13 @@
|
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
116
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
117
|
-
"@libp2p/circuit-relay-v2": "
|
|
118
|
-
"@libp2p/identify": "
|
|
119
|
-
"@libp2p/interface-compliance-tests": "
|
|
120
|
-
"@libp2p/mplex": "
|
|
121
|
-
"@libp2p/plaintext": "
|
|
122
|
-
"@libp2p/tcp": "
|
|
123
|
-
"@libp2p/websockets": "
|
|
117
|
+
"@libp2p/circuit-relay-v2": "1.1.5-3c8dd5bbf",
|
|
118
|
+
"@libp2p/identify": "2.1.5-3c8dd5bbf",
|
|
119
|
+
"@libp2p/interface-compliance-tests": "5.4.12-3c8dd5bbf",
|
|
120
|
+
"@libp2p/mplex": "10.1.5-3c8dd5bbf",
|
|
121
|
+
"@libp2p/plaintext": "1.1.6-3c8dd5bbf",
|
|
122
|
+
"@libp2p/tcp": "9.1.5-3c8dd5bbf",
|
|
123
|
+
"@libp2p/websockets": "8.2.0-3c8dd5bbf",
|
|
124
124
|
"@multiformats/mafmt": "^12.1.6",
|
|
125
125
|
"aegir": "^44.0.1",
|
|
126
126
|
"delay": "^6.0.0",
|
|
@@ -6,6 +6,9 @@ import type { ConnectionManager } from '@libp2p/interface-internal'
|
|
|
6
6
|
import type { AdaptiveTimeoutInit } from '@libp2p/utils/adaptive-timeout'
|
|
7
7
|
|
|
8
8
|
const DEFAULT_PING_INTERVAL_MS = 10000
|
|
9
|
+
const PROTOCOL_VERSION = '1.0.0'
|
|
10
|
+
const PROTOCOL_NAME = 'ping'
|
|
11
|
+
const PROTOCOL_PREFIX = 'ipfs'
|
|
9
12
|
|
|
10
13
|
export interface ConnectionMonitorInit {
|
|
11
14
|
/**
|
|
@@ -37,6 +40,13 @@ export interface ConnectionMonitorInit {
|
|
|
37
40
|
* @default true
|
|
38
41
|
*/
|
|
39
42
|
abortConnectionOnPingFailure?: boolean
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Override the ping protocol prefix
|
|
46
|
+
*
|
|
47
|
+
* @default 'ipfs'
|
|
48
|
+
*/
|
|
49
|
+
protocolPrefix?: string
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
export interface ConnectionMonitorComponents {
|
|
@@ -46,6 +56,7 @@ export interface ConnectionMonitorComponents {
|
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
export class ConnectionMonitor implements Startable {
|
|
59
|
+
private readonly protocol: string
|
|
49
60
|
private readonly components: ConnectionMonitorComponents
|
|
50
61
|
private readonly log: Logger
|
|
51
62
|
private heartbeatInterval?: ReturnType<typeof setInterval>
|
|
@@ -55,6 +66,7 @@ export class ConnectionMonitor implements Startable {
|
|
|
55
66
|
|
|
56
67
|
constructor (components: ConnectionMonitorComponents, init: ConnectionMonitorInit = {}) {
|
|
57
68
|
this.components = components
|
|
69
|
+
this.protocol = `/${init.protocolPrefix ?? PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`
|
|
58
70
|
|
|
59
71
|
this.log = components.logger.forComponent('libp2p:connection-monitor')
|
|
60
72
|
this.pingIntervalMs = init.pingInterval ?? DEFAULT_PING_INTERVAL_MS
|
|
@@ -83,7 +95,7 @@ export class ConnectionMonitor implements Startable {
|
|
|
83
95
|
const signal = this.timeout.getTimeoutSignal({
|
|
84
96
|
signal: this.abortController?.signal
|
|
85
97
|
})
|
|
86
|
-
const stream = await conn.newStream(
|
|
98
|
+
const stream = await conn.newStream(this.protocol, {
|
|
87
99
|
signal,
|
|
88
100
|
runOnTransientConnection: true
|
|
89
101
|
})
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '1.9.
|
|
1
|
+
export const version = '1.9.1-3c8dd5bbf'
|
|
2
2
|
export const name = 'libp2p'
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
3
|
-
".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
4
|
-
"Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
5
|
-
".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
6
|
-
"ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
7
|
-
".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
8
|
-
"createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
9
|
-
".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
10
|
-
"name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
|
|
11
|
-
"./version:name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
|
|
12
|
-
"version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html",
|
|
13
|
-
"./version:version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html"
|
|
14
|
-
}
|