@olane/o-config 0.7.12-alpha.3 → 0.7.12-alpha.31
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/config/config.d.ts +2 -0
- package/dist/src/config/config.d.ts.map +1 -1
- package/dist/src/config/config.js +12 -6
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/node/node.d.ts.map +1 -1
- package/dist/src/node/node.js +11 -0
- package/package.json +3 -2
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Libp2pInit } from 'libp2p';
|
|
2
|
+
import type { Registry } from 'prom-client';
|
|
2
3
|
export interface Libp2pConfig extends Libp2pInit {
|
|
3
4
|
listeners?: string[];
|
|
4
5
|
transports?: any[];
|
|
5
6
|
connectionEncrypters?: any[];
|
|
6
7
|
streamMuxers?: any[];
|
|
7
8
|
services?: Record<string, any>;
|
|
9
|
+
prometheusRegistry?: Registry;
|
|
8
10
|
}
|
|
9
11
|
export declare const defaultLibp2pConfig: Libp2pConfig;
|
|
10
12
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAMpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,EAAE,YA2BjC,CAAC"}
|
|
@@ -13,7 +13,10 @@ export const defaultLibp2pConfig = {
|
|
|
13
13
|
connectionEncrypters: [noise()],
|
|
14
14
|
streamMuxers: [yamux()],
|
|
15
15
|
services: {
|
|
16
|
-
ping: ping(
|
|
16
|
+
ping: ping({
|
|
17
|
+
maxInboundStreams: 1_000,
|
|
18
|
+
maxOutboundStreams: 1_000,
|
|
19
|
+
}),
|
|
17
20
|
identify: identify(),
|
|
18
21
|
dht: kadDHT({
|
|
19
22
|
peerInfoMapper: removePublicAddressesMapper,
|
|
@@ -22,10 +25,13 @@ export const defaultLibp2pConfig = {
|
|
|
22
25
|
}),
|
|
23
26
|
},
|
|
24
27
|
connectionManager: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// UPDATED: Changed from Infinity to sensible limits to prevent resource exhaustion
|
|
29
|
+
// These limits help prevent CONNECTION_FAILED errors when many tools start simultaneously
|
|
30
|
+
// or when operating through circuit relays with their own connection limits
|
|
31
|
+
maxConnections: 200, // Allow up to 200 concurrent connections (was Infinity)
|
|
32
|
+
maxParallelDials: 10, // Limit concurrent dial attempts to prevent flooding (was Infinity)
|
|
33
|
+
maxDialQueueLength: 100, // Queue up to 100 pending dials (was Infinity)
|
|
34
|
+
maxPeerAddrsToDial: 25, // Try up to 25 different addresses per peer (was Infinity)
|
|
35
|
+
inboundConnectionThreshold: Infinity, // Keep unlimited inbound (typically less of an issue)
|
|
30
36
|
},
|
|
31
37
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ export { memory } from '@libp2p/memory';
|
|
|
25
25
|
export { ping } from '@libp2p/ping';
|
|
26
26
|
export { identify } from '@libp2p/identify';
|
|
27
27
|
export { duplexPair } from 'it-pair/duplex';
|
|
28
|
+
export { prometheusMetrics } from '@libp2p/prometheus-metrics';
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;A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AAoB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAuB,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAuB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxE,wBAAsB,UAAU,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB3E"}
|
package/dist/src/node/node.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLibp2p } from 'libp2p';
|
|
2
2
|
import { defaultLibp2pConfig } from '../config/config.js';
|
|
3
|
+
import { prometheusMetrics } from '@libp2p/prometheus-metrics';
|
|
3
4
|
export async function createNode(config = {}) {
|
|
4
5
|
const mergedConfig = {
|
|
5
6
|
...defaultLibp2pConfig,
|
|
@@ -9,5 +10,15 @@ export async function createNode(config = {}) {
|
|
|
9
10
|
...config.addresses,
|
|
10
11
|
},
|
|
11
12
|
};
|
|
13
|
+
// Add prometheus metrics service if registry is provided
|
|
14
|
+
if (config.prometheusRegistry) {
|
|
15
|
+
mergedConfig.services = {
|
|
16
|
+
...mergedConfig.services,
|
|
17
|
+
metrics: prometheusMetrics({
|
|
18
|
+
preserveExistingMetrics: true,
|
|
19
|
+
registry: config.prometheusRegistry,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
12
23
|
return await createLibp2p(mergedConfig);
|
|
13
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-config",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"@libp2p/peer-id-factory": "^4.2.4",
|
|
67
67
|
"@libp2p/peer-store": "^12.0.5",
|
|
68
68
|
"@libp2p/ping": "^3.0.5",
|
|
69
|
+
"@libp2p/prometheus-metrics": "^5.0.7",
|
|
69
70
|
"@libp2p/pubsub": "^10.1.18",
|
|
70
71
|
"@libp2p/tcp": "^11.0.5",
|
|
71
72
|
"@libp2p/utils": "^7.0.5",
|
|
@@ -78,5 +79,5 @@
|
|
|
78
79
|
"libp2p": "^3.0.6",
|
|
79
80
|
"uint8arraylist": "^2.4.8"
|
|
80
81
|
},
|
|
81
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "0b44496fc3128720d705878c152cef6fe1e84402"
|
|
82
83
|
}
|