@hive-p2p/browser 1.0.33 → 1.0.35
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/arbiter.mjs +2 -1
- package/core/config.mjs +1 -7
- package/core/crypto-codex.mjs +2 -1
- package/core/gossip.mjs +2 -1
- package/core/ice-offer-manager.mjs +2 -1
- package/core/node.mjs +2 -1
- package/core/peer-store.mjs +2 -1
- package/core/topologist.mjs +2 -1
- package/hive-p2p.min.js +3 -3
- package/index.mjs +14 -3
- package/package.json +1 -1
- package/services/clock.mjs +1 -1
package/core/arbiter.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { GOSSIP, UNICAST, LOG_CSS } from './config.mjs';
|
|
2
3
|
|
|
3
4
|
// TRUST_BALANCE = seconds of ban if negative - never exceed MAX_TRUST if positive
|
|
4
5
|
// Growing each second by 1000ms until 0
|
package/core/config.mjs
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
const isNode = (typeof window === 'undefined');
|
|
2
2
|
if (!isNode) (await import('../libs/simplepeer-9.11.1.min.js')).default;
|
|
3
|
-
import { Clock } from '../services/clock.mjs';
|
|
4
3
|
|
|
5
4
|
// HOLD: GLOBAL CONFIG FOR THE LIBRARY
|
|
6
5
|
// AVOID: CIRCULAR DEPENDENCIES AND TOO MANY FUNCTION/CONSTRUCTOR CONFIG
|
|
7
6
|
// SIMPLIFY: IMPORTS, SIMULATOR AND BROWSER SUPPORT
|
|
8
7
|
|
|
9
|
-
/** Synchronized clock that can be used outside the library */
|
|
10
|
-
export const CLOCK = Clock.instance;
|
|
11
|
-
|
|
12
8
|
export const SIMULATION = {
|
|
13
9
|
/** Specify setInterval() avoidance for faster simulation (true = avoid intervals) | Default: true */
|
|
14
10
|
AVOID_INTERVALS: false,
|
|
@@ -223,6 +219,4 @@ export const LOG_CSS = {
|
|
|
223
219
|
PUNISHER: { BAN: 'color: red; font-weight: bold;', KICK: 'color: darkorange; font-weight: bold;' },
|
|
224
220
|
}
|
|
225
221
|
|
|
226
|
-
export default {
|
|
227
|
-
CLOCK, SIMULATION, NODE, TRANSPORTS, DISCOVERY, IDENTITY, UNICAST, GOSSIP, LOG_CSS
|
|
228
|
-
};
|
|
222
|
+
export default { SIMULATION, NODE, TRANSPORTS, DISCOVERY, IDENTITY, UNICAST, GOSSIP, LOG_CSS };
|
package/core/crypto-codex.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { SIMULATION, NODE, IDENTITY, GOSSIP, UNICAST, LOG_CSS } from './config.mjs';
|
|
2
3
|
import { GossipMessage } from './gossip.mjs';
|
|
3
4
|
import { DirectMessage, ReroutedDirectMessage } from './unicast.mjs';
|
|
4
5
|
import { Converter } from '../services/converter.mjs';
|
package/core/gossip.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { NODE, TRANSPORTS, LOG_CSS } from './config.mjs';
|
|
2
3
|
import { xxHash32 } from '../libs/xxhash32.mjs';
|
|
3
4
|
async function getWrtc() {
|
|
4
5
|
if (typeof globalThis.RTCPeerConnection !== 'undefined') return undefined;
|
package/core/node.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { SIMULATION, NODE, SERVICE, DISCOVERY } from './config.mjs';
|
|
2
3
|
import { Arbiter } from './arbiter.mjs';
|
|
3
4
|
import { OfferManager } from './ice-offer-manager.mjs';
|
|
4
5
|
import { PeerStore } from './peer-store.mjs';
|
package/core/peer-store.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { SIMULATION, NODE, DISCOVERY, LOG_CSS } from './config.mjs';
|
|
2
3
|
const { SANDBOX, ICE_CANDIDATE_EMITTER, TEST_WS_EVENT_MANAGER } = SIMULATION.ENABLED ? await import('../simulation/test-transports.mjs') : {};
|
|
3
4
|
|
|
4
5
|
export class KnownPeer { // known peer, not necessarily connected
|
package/core/topologist.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CLOCK
|
|
1
|
+
import { CLOCK } from '../services/clock.mjs';
|
|
2
|
+
import { SIMULATION, TRANSPORTS, NODE, DISCOVERY, GOSSIP } from './config.mjs';
|
|
2
3
|
import { PeerConnection } from './peer-store.mjs';
|
|
3
4
|
const { SANDBOX, ICE_CANDIDATE_EMITTER, TEST_WS_EVENT_MANAGER } = SIMULATION.ENABLED ? await import('../simulation/test-transports.mjs') : {};
|
|
4
5
|
|