@minip2p/node 0.11.1 → 0.11.3

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/adapter.js CHANGED
@@ -16,12 +16,12 @@ function nodeBackend(config) {
16
16
  }
17
17
  /** High-level Node.js owner for one native minip2p endpoint. */
18
18
  export class Minip2p extends Minip2pBase {
19
- constructor(backend, relays) {
20
- super(backend, relays);
19
+ constructor(backend, config) {
20
+ super(backend, config);
21
21
  }
22
22
  /** Constructs and starts a Node.js endpoint. */
23
23
  static create(config) {
24
- return new Minip2p(nodeBackend(config), config.relays ?? []);
24
+ return new Minip2p(nodeBackend(config), config);
25
25
  }
26
26
  }
27
27
  /** Generates a new 32-byte Ed25519 secret key. */
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAE5G,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,SAAS,WAAW,CAAC,MAAqB;IACxC,MAAM,QAAQ,GAAG,eAAe,CAC9B,GAAG,EAAE,CACH,IAAI,aAAa,CAAC,YAAY,CAC5B,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,EAC9B,qBAAqB,CAAC,MAAM,CAAC,CAC9B,CACJ,CAAC;IACF,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE;QAChC,cAAc;QACd,wEAAwE;QACxE,gEAAgE;QAChE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;YACjB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,OAAO,OAAQ,SAA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AC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC"}
package/dist/addon.d.ts CHANGED
@@ -139,6 +139,8 @@ export interface NodeEndpointConfig {
139
139
  mdns?: NodeMdnsOptions
140
140
  /** Transport limit overrides. */
141
141
  limits?: NodeLimitsOptions
142
+ /** Protocol deadline overrides. */
143
+ timeouts?: NodeTimeoutsOptions
142
144
  }
143
145
 
144
146
  /** Transport limit overrides accepted from Node.js; see `LimitsOptions`. */
@@ -197,6 +199,12 @@ export interface NodeQuicLimitsOptions {
197
199
  sendWindow?: bigint
198
200
  /** WebTransport handshake timeout in milliseconds. */
199
201
  webtransportHandshakeTimeoutMs?: bigint
202
+ /** `"cubic"`, `"newReno"` or `"bbr"`. */
203
+ congestionController?: string
204
+ /** Packet reordering threshold. */
205
+ packetThreshold?: number
206
+ /** Time reordering threshold, as a multiple of the RTT. */
207
+ timeThreshold?: number
200
208
  }
201
209
 
202
210
  /** TCP limit overrides accepted from Node.js; see `TcpLimitsOptions`. */
@@ -213,6 +221,16 @@ export interface NodeTcpLimitsOptions {
213
221
  yamux?: NodeYamuxOptions
214
222
  }
215
223
 
224
+ /** Protocol deadline overrides accepted from Node.js; see `TimeoutsOptions`. */
225
+ export interface NodeTimeoutsOptions {
226
+ /** How long an outbound stream may negotiate its protocol, in ms. */
227
+ negotiationMs?: bigint
228
+ /** How long a connection's first Identify may take, in ms. */
229
+ identifyMs?: bigint
230
+ /** How long a ping may take (open, negotiation and echo), in ms. */
231
+ pingMs?: bigint
232
+ }
233
+
216
234
  /** Yamux limit overrides accepted from Node.js; see `YamuxOptions`. */
217
235
  export interface NodeYamuxOptions {
218
236
  /** Per-stream receive window. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minip2p/node",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "Node.js bindings for minip2p",
5
5
  "keywords": [
6
6
  "libp2p",
@@ -38,7 +38,7 @@
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
40
  "dependencies": {
41
- "@minip2p/core": "0.11.1"
41
+ "@minip2p/core": "0.11.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@minip2p/test-fixtures": "0.0.0",
@@ -48,13 +48,13 @@
48
48
  "typescript": "7.0.2"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@minip2p/node-darwin-arm64": "0.11.1",
52
- "@minip2p/node-darwin-x64": "0.11.1",
53
- "@minip2p/node-linux-arm64-gnu": "0.11.1",
54
- "@minip2p/node-linux-arm64-musl": "0.11.1",
55
- "@minip2p/node-linux-x64-gnu": "0.11.1",
56
- "@minip2p/node-linux-x64-musl": "0.11.1",
57
- "@minip2p/node-win32-x64-msvc": "0.11.1"
51
+ "@minip2p/node-darwin-arm64": "0.11.3",
52
+ "@minip2p/node-darwin-x64": "0.11.3",
53
+ "@minip2p/node-linux-arm64-gnu": "0.11.3",
54
+ "@minip2p/node-linux-arm64-musl": "0.11.3",
55
+ "@minip2p/node-linux-x64-gnu": "0.11.3",
56
+ "@minip2p/node-linux-x64-musl": "0.11.3",
57
+ "@minip2p/node-win32-x64-msvc": "0.11.3"
58
58
  },
59
59
  "napi": {
60
60
  "binaryName": "minip2p",
package/src/adapter.ts CHANGED
@@ -28,13 +28,13 @@ function nodeBackend(config: Minip2pConfig): Minip2pBackend {
28
28
 
29
29
  /** High-level Node.js owner for one native minip2p endpoint. */
30
30
  export class Minip2p extends Minip2pBase {
31
- private constructor(backend: Minip2pBackend, relays: readonly string[]) {
32
- super(backend, relays);
31
+ private constructor(backend: Minip2pBackend, config: Minip2pConfig) {
32
+ super(backend, config);
33
33
  }
34
34
 
35
35
  /** Constructs and starts a Node.js endpoint. */
36
36
  static create(config: Minip2pConfig): Minip2p {
37
- return new Minip2p(nodeBackend(config), config.relays ?? []);
37
+ return new Minip2p(nodeBackend(config), config);
38
38
  }
39
39
  }
40
40
 
package/src/addon.d.ts CHANGED
@@ -139,6 +139,8 @@ export interface NodeEndpointConfig {
139
139
  mdns?: NodeMdnsOptions
140
140
  /** Transport limit overrides. */
141
141
  limits?: NodeLimitsOptions
142
+ /** Protocol deadline overrides. */
143
+ timeouts?: NodeTimeoutsOptions
142
144
  }
143
145
 
144
146
  /** Transport limit overrides accepted from Node.js; see `LimitsOptions`. */
@@ -197,6 +199,12 @@ export interface NodeQuicLimitsOptions {
197
199
  sendWindow?: bigint
198
200
  /** WebTransport handshake timeout in milliseconds. */
199
201
  webtransportHandshakeTimeoutMs?: bigint
202
+ /** `"cubic"`, `"newReno"` or `"bbr"`. */
203
+ congestionController?: string
204
+ /** Packet reordering threshold. */
205
+ packetThreshold?: number
206
+ /** Time reordering threshold, as a multiple of the RTT. */
207
+ timeThreshold?: number
200
208
  }
201
209
 
202
210
  /** TCP limit overrides accepted from Node.js; see `TcpLimitsOptions`. */
@@ -213,6 +221,16 @@ export interface NodeTcpLimitsOptions {
213
221
  yamux?: NodeYamuxOptions
214
222
  }
215
223
 
224
+ /** Protocol deadline overrides accepted from Node.js; see `TimeoutsOptions`. */
225
+ export interface NodeTimeoutsOptions {
226
+ /** How long an outbound stream may negotiate its protocol, in ms. */
227
+ negotiationMs?: bigint
228
+ /** How long a connection's first Identify may take, in ms. */
229
+ identifyMs?: bigint
230
+ /** How long a ping may take (open, negotiation and echo), in ms. */
231
+ pingMs?: bigint
232
+ }
233
+
216
234
  /** Yamux limit overrides accepted from Node.js; see `YamuxOptions`. */
217
235
  export interface NodeYamuxOptions {
218
236
  /** Per-stream receive window. */