@hive-p2p/server 1.0.43 → 1.0.45
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/core/node.mjs +6 -6
- package/core/topologist.mjs +1 -1
- package/index.mjs +11 -12
- package/package.json +1 -1
package/core/node.mjs
CHANGED
|
@@ -56,12 +56,12 @@ export async function createNode(options = {}) {
|
|
|
56
56
|
export class Node {
|
|
57
57
|
started = false;
|
|
58
58
|
id; cryptoCodex; verbose;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
offerManager;
|
|
60
|
+
arbiter;
|
|
61
|
+
peerStore;
|
|
62
|
+
messager;
|
|
63
|
+
gossip;
|
|
64
|
+
topologist;
|
|
65
65
|
/** @type {NodeServices | undefined} */ services;
|
|
66
66
|
|
|
67
67
|
/** Initialize a new P2P node instance, use .start() to init topologist
|
package/core/topologist.mjs
CHANGED
|
@@ -19,7 +19,7 @@ const { SANDBOX, ICE_CANDIDATE_EMITTER, TEST_WS_EVENT_MANAGER } = SIMULATION.ENA
|
|
|
19
19
|
* @property {number} timestamp
|
|
20
20
|
* */
|
|
21
21
|
|
|
22
|
-
class OfferQueue {
|
|
22
|
+
export class OfferQueue {
|
|
23
23
|
maxOffers = 30;
|
|
24
24
|
/** @type {Array<OfferQueueItem>} */ offers = [];
|
|
25
25
|
/** @type {'overlap' | 'neighborsCount'} */ orderingBy = 'neighborsCount';
|
package/index.mjs
CHANGED
|
@@ -3,6 +3,17 @@ import { CryptoCodex } from "./core/crypto-codex.mjs";
|
|
|
3
3
|
import { CLOCK } from "./services/clock.mjs';
|
|
4
4
|
import CONFIG from "./core/config.mjs";
|
|
5
5
|
|
|
6
|
+
// FOR IDE COMPLETION
|
|
7
|
+
import { Arbiter } from "./core/arbiter.mjs";
|
|
8
|
+
import { OfferManager } from "./core/offer-manager.mjs";
|
|
9
|
+
import { PeerStore, KnownPeer, PeerConnection } from "./core/peer-store.mjs";
|
|
10
|
+
import { UnicastMessager, DirectMessage, ReroutedDirectMessage } from "./core/unicast.mjs";
|
|
11
|
+
import { Gossip, GossipMessage } from "./core/gossip.mjs";
|
|
12
|
+
import { Topologist, OfferQueue } from "./core/topologist.mjs";
|
|
13
|
+
import { NodeServices } from "./core/node-services.mjs";
|
|
14
|
+
import { Converter } from "./services/converter.mjs";
|
|
15
|
+
import { ed25519, Argon2Unified } from "./services/cryptos.mjs";
|
|
16
|
+
|
|
6
17
|
function mergeConfig(target, source) {
|
|
7
18
|
for (const key in source)
|
|
8
19
|
if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
|
@@ -11,18 +22,6 @@ function mergeConfig(target, source) {
|
|
|
11
22
|
} else target[key] = source[key];
|
|
12
23
|
}
|
|
13
24
|
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {Object} HiveP2PNamespace
|
|
16
|
-
* @property {typeof CLOCK} CLOCK
|
|
17
|
-
* @property {typeof CONFIG} CONFIG
|
|
18
|
-
* @property {typeof mergeConfig} mergeConfig
|
|
19
|
-
* @property {typeof Node} Node
|
|
20
|
-
* @property {typeof createNode} createNode
|
|
21
|
-
* @property {typeof CryptoCodex} CryptoCodex
|
|
22
|
-
* @property {typeof createPublicNode} createPublicNode
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/** @type {HiveP2PNamespace} */
|
|
26
25
|
const HiveP2P = { CLOCK, CONFIG, mergeConfig, Node, createNode, createPublicNode, CryptoCodex };
|
|
27
26
|
export { CLOCK, CONFIG, mergeConfig, Node, createNode, createPublicNode, CryptoCodex };
|
|
28
27
|
export default HiveP2P;
|