@leofcoin/peernet 0.14.19 → 0.14.21
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/browser/pako.js +670 -501
- package/dist/browser/pako.mjs +670 -501
- package/dist/browser/peernet-swarm.js +5 -11
- package/dist/browser/peernet-swarm.mjs +5 -11
- package/dist/browser/peernet.js +2 -12
- package/dist/browser/peernet.mjs +2 -12
- package/dist/commonjs/peernet.js +1 -10
- package/dist/module/peernet.js +1 -10
- package/package.json +2 -2
- package/src/peernet.js +1 -10
|
@@ -506,27 +506,21 @@ class Peer {
|
|
|
506
506
|
}})
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
isNotReallyStable(signalinState) {
|
|
510
|
-
if (signalinState !== 'stable') return true
|
|
511
|
-
// remoteDescription & localDescription are null when the connection is just made
|
|
512
|
-
if (this.#connection.remoteDescription === null && this.#connection.localDescription === null) return true
|
|
513
|
-
return false
|
|
514
|
-
}
|
|
515
|
-
|
|
516
509
|
async _in(message, data) {
|
|
517
510
|
// message = JSON.parse(message);
|
|
518
511
|
if (message.to !== this.id) return
|
|
519
512
|
// if (data.videocall) return this._startStream(true, false); // start video and audio stream
|
|
520
513
|
// if (data.call) return this._startStream(true, true); // start audio stream
|
|
514
|
+
if (this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
|
|
515
|
+
|
|
521
516
|
if (message.candidate) {
|
|
522
517
|
debug(`incoming candidate ${this.#channelName}`)
|
|
523
|
-
debug(message.candidate.candidate)
|
|
518
|
+
// debug(message.candidate.candidate)
|
|
524
519
|
this.remoteAddress = message.candidate.address
|
|
525
520
|
this.remotePort = message.candidate.port
|
|
526
521
|
this.remoteProtocol = message.candidate.protocol
|
|
527
|
-
this.remoteIpFamily = this.remoteAddress?.includes('::') ? 'ipv6': 'ipv4'
|
|
528
|
-
|
|
529
|
-
if (signalinState !== 'closed' && this.isNotReallyStable(signalinState)) return this.#connection.addIceCandidate(new wrtc.RTCIceCandidate(message.candidate));
|
|
522
|
+
this.remoteIpFamily = this.remoteAddress?.includes('::') ? 'ipv6': 'ipv4'
|
|
523
|
+
return this.#connection.addIceCandidate(new wrtc.RTCIceCandidate(message.candidate));
|
|
530
524
|
}
|
|
531
525
|
try {
|
|
532
526
|
if (message.sdp) {
|
|
@@ -505,27 +505,21 @@ class Peer {
|
|
|
505
505
|
}})
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
isNotReallyStable(signalinState) {
|
|
509
|
-
if (signalinState !== 'stable') return true
|
|
510
|
-
// remoteDescription & localDescription are null when the connection is just made
|
|
511
|
-
if (this.#connection.remoteDescription === null && this.#connection.localDescription === null) return true
|
|
512
|
-
return false
|
|
513
|
-
}
|
|
514
|
-
|
|
515
508
|
async _in(message, data) {
|
|
516
509
|
// message = JSON.parse(message);
|
|
517
510
|
if (message.to !== this.id) return
|
|
518
511
|
// if (data.videocall) return this._startStream(true, false); // start video and audio stream
|
|
519
512
|
// if (data.call) return this._startStream(true, true); // start audio stream
|
|
513
|
+
if (this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
|
|
514
|
+
|
|
520
515
|
if (message.candidate) {
|
|
521
516
|
debug(`incoming candidate ${this.#channelName}`)
|
|
522
|
-
debug(message.candidate.candidate)
|
|
517
|
+
// debug(message.candidate.candidate)
|
|
523
518
|
this.remoteAddress = message.candidate.address
|
|
524
519
|
this.remotePort = message.candidate.port
|
|
525
520
|
this.remoteProtocol = message.candidate.protocol
|
|
526
|
-
this.remoteIpFamily = this.remoteAddress?.includes('::') ? 'ipv6': 'ipv4'
|
|
527
|
-
|
|
528
|
-
if (signalinState !== 'closed' && this.isNotReallyStable(signalinState)) return this.#connection.addIceCandidate(new wrtc.RTCIceCandidate(message.candidate));
|
|
521
|
+
this.remoteIpFamily = this.remoteAddress?.includes('::') ? 'ipv6': 'ipv4'
|
|
522
|
+
return this.#connection.addIceCandidate(new wrtc.RTCIceCandidate(message.candidate));
|
|
529
523
|
}
|
|
530
524
|
try {
|
|
531
525
|
if (message.sdp) {
|
package/dist/browser/peernet.js
CHANGED
|
@@ -8285,8 +8285,7 @@ module.exports = function (value) {
|
|
|
8285
8285
|
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
8286
8286
|
/******/ doneFns && doneFns.forEach(function(fn) { return fn(event); });
|
|
8287
8287
|
/******/ if(prev) return prev(event);
|
|
8288
|
-
/******/ }
|
|
8289
|
-
/******/ ;
|
|
8288
|
+
/******/ };
|
|
8290
8289
|
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
8291
8290
|
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
8292
8291
|
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
@@ -9120,7 +9119,7 @@ class Peernet {
|
|
|
9120
9119
|
this.peerId = this.id;
|
|
9121
9120
|
|
|
9122
9121
|
pubsub.subscribe('peer:connected', async (peer) => {
|
|
9123
|
-
console.log(peer);
|
|
9122
|
+
// console.log(peer);
|
|
9124
9123
|
// console.log({connected: peer.id, as: this._getPeerId(peer.id) });
|
|
9125
9124
|
// peer.on('peernet.data', async (message) => {
|
|
9126
9125
|
// const id = message.id
|
|
@@ -9230,7 +9229,6 @@ class Peernet {
|
|
|
9230
9229
|
const walk = async peer => {
|
|
9231
9230
|
const node = await this.prepareMessage(data);
|
|
9232
9231
|
let result = await peer.request(node.encoded);
|
|
9233
|
-
console.log({result});
|
|
9234
9232
|
result = new Uint8Array(Object.values(result));
|
|
9235
9233
|
const proto = await protoFor(result);
|
|
9236
9234
|
if (proto.name !== 'peernet-dht-response') throw dhtError(proto.name)
|
|
@@ -9577,14 +9575,6 @@ class Peernet {
|
|
|
9577
9575
|
get Buffer() {
|
|
9578
9576
|
return Buffer
|
|
9579
9577
|
}
|
|
9580
|
-
// async block(index) {
|
|
9581
|
-
// const _values = []
|
|
9582
|
-
// for (const peer of this.peers) {
|
|
9583
|
-
// const value = await peer.request({type: 'block', index})
|
|
9584
|
-
// console.log(value);
|
|
9585
|
-
// }
|
|
9586
|
-
//
|
|
9587
|
-
// }
|
|
9588
9578
|
}
|
|
9589
9579
|
globalThis.Peernet = Peernet;
|
|
9590
9580
|
|
package/dist/browser/peernet.mjs
CHANGED
|
@@ -8267,8 +8267,7 @@ module.exports = function (value) {
|
|
|
8267
8267
|
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
8268
8268
|
/******/ doneFns && doneFns.forEach(function(fn) { return fn(event); });
|
|
8269
8269
|
/******/ if(prev) return prev(event);
|
|
8270
|
-
/******/ }
|
|
8271
|
-
/******/ ;
|
|
8270
|
+
/******/ };
|
|
8272
8271
|
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
8273
8272
|
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
8274
8273
|
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
@@ -9090,7 +9089,7 @@ class Peernet {
|
|
|
9090
9089
|
this.peerId = this.id;
|
|
9091
9090
|
|
|
9092
9091
|
pubsub.subscribe('peer:connected', async (peer) => {
|
|
9093
|
-
console.log(peer);
|
|
9092
|
+
// console.log(peer);
|
|
9094
9093
|
// console.log({connected: peer.id, as: this._getPeerId(peer.id) });
|
|
9095
9094
|
// peer.on('peernet.data', async (message) => {
|
|
9096
9095
|
// const id = message.id
|
|
@@ -9200,7 +9199,6 @@ class Peernet {
|
|
|
9200
9199
|
const walk = async peer => {
|
|
9201
9200
|
const node = await this.prepareMessage(data);
|
|
9202
9201
|
let result = await peer.request(node.encoded);
|
|
9203
|
-
console.log({result});
|
|
9204
9202
|
result = new Uint8Array(Object.values(result));
|
|
9205
9203
|
const proto = await protoFor(result);
|
|
9206
9204
|
if (proto.name !== 'peernet-dht-response') throw dhtError(proto.name)
|
|
@@ -9547,14 +9545,6 @@ class Peernet {
|
|
|
9547
9545
|
get Buffer() {
|
|
9548
9546
|
return Buffer
|
|
9549
9547
|
}
|
|
9550
|
-
// async block(index) {
|
|
9551
|
-
// const _values = []
|
|
9552
|
-
// for (const peer of this.peers) {
|
|
9553
|
-
// const value = await peer.request({type: 'block', index})
|
|
9554
|
-
// console.log(value);
|
|
9555
|
-
// }
|
|
9556
|
-
//
|
|
9557
|
-
// }
|
|
9558
9548
|
}
|
|
9559
9549
|
globalThis.Peernet = Peernet;
|
|
9560
9550
|
|
package/dist/commonjs/peernet.js
CHANGED
|
@@ -652,7 +652,7 @@ class Peernet {
|
|
|
652
652
|
this.peerId = this.id;
|
|
653
653
|
|
|
654
654
|
pubsub.subscribe('peer:connected', async (peer) => {
|
|
655
|
-
console.log(peer);
|
|
655
|
+
// console.log(peer);
|
|
656
656
|
// console.log({connected: peer.id, as: this._getPeerId(peer.id) });
|
|
657
657
|
// peer.on('peernet.data', async (message) => {
|
|
658
658
|
// const id = message.id
|
|
@@ -762,7 +762,6 @@ class Peernet {
|
|
|
762
762
|
const walk = async peer => {
|
|
763
763
|
const node = await this.prepareMessage(data);
|
|
764
764
|
let result = await peer.request(node.encoded);
|
|
765
|
-
console.log({result});
|
|
766
765
|
result = new Uint8Array(Object.values(result));
|
|
767
766
|
const proto = await protoFor(result);
|
|
768
767
|
if (proto.name !== 'peernet-dht-response') throw dhtError(proto.name)
|
|
@@ -1109,14 +1108,6 @@ class Peernet {
|
|
|
1109
1108
|
get Buffer() {
|
|
1110
1109
|
return Buffer
|
|
1111
1110
|
}
|
|
1112
|
-
// async block(index) {
|
|
1113
|
-
// const _values = []
|
|
1114
|
-
// for (const peer of this.peers) {
|
|
1115
|
-
// const value = await peer.request({type: 'block', index})
|
|
1116
|
-
// console.log(value);
|
|
1117
|
-
// }
|
|
1118
|
-
//
|
|
1119
|
-
// }
|
|
1120
1111
|
}
|
|
1121
1112
|
globalThis.Peernet = Peernet;
|
|
1122
1113
|
|
package/dist/module/peernet.js
CHANGED
|
@@ -626,7 +626,7 @@ class Peernet {
|
|
|
626
626
|
this.peerId = this.id;
|
|
627
627
|
|
|
628
628
|
pubsub.subscribe('peer:connected', async (peer) => {
|
|
629
|
-
console.log(peer);
|
|
629
|
+
// console.log(peer);
|
|
630
630
|
// console.log({connected: peer.id, as: this._getPeerId(peer.id) });
|
|
631
631
|
// peer.on('peernet.data', async (message) => {
|
|
632
632
|
// const id = message.id
|
|
@@ -736,7 +736,6 @@ class Peernet {
|
|
|
736
736
|
const walk = async peer => {
|
|
737
737
|
const node = await this.prepareMessage(data);
|
|
738
738
|
let result = await peer.request(node.encoded);
|
|
739
|
-
console.log({result});
|
|
740
739
|
result = new Uint8Array(Object.values(result));
|
|
741
740
|
const proto = await protoFor(result);
|
|
742
741
|
if (proto.name !== 'peernet-dht-response') throw dhtError(proto.name)
|
|
@@ -1083,14 +1082,6 @@ class Peernet {
|
|
|
1083
1082
|
get Buffer() {
|
|
1084
1083
|
return Buffer
|
|
1085
1084
|
}
|
|
1086
|
-
// async block(index) {
|
|
1087
|
-
// const _values = []
|
|
1088
|
-
// for (const peer of this.peers) {
|
|
1089
|
-
// const value = await peer.request({type: 'block', index})
|
|
1090
|
-
// console.log(value);
|
|
1091
|
-
// }
|
|
1092
|
-
//
|
|
1093
|
-
// }
|
|
1094
1085
|
}
|
|
1095
1086
|
globalThis.Peernet = Peernet;
|
|
1096
1087
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "src/peernet.js",
|
|
6
6
|
"main": "dist/commonjs/peernet.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@leofcoin/codec-format-interface": "^1.4.0",
|
|
30
30
|
"@leofcoin/generate-account": "^1.0.4",
|
|
31
31
|
"@leofcoin/multi-wallet": "^2.1.2",
|
|
32
|
-
"@leofcoin/peernet-swarm": "^0.3.
|
|
32
|
+
"@leofcoin/peernet-swarm": "^0.3.10",
|
|
33
33
|
"@leofcoin/storage": "^3.0.0",
|
|
34
34
|
"@vandeurenglenn/base32": "^1.1.0",
|
|
35
35
|
"@vandeurenglenn/base58": "^1.1.0",
|
package/src/peernet.js
CHANGED
|
@@ -228,7 +228,7 @@ export default class Peernet {
|
|
|
228
228
|
this.peerId = this.id
|
|
229
229
|
|
|
230
230
|
pubsub.subscribe('peer:connected', async (peer) => {
|
|
231
|
-
console.log(peer);
|
|
231
|
+
// console.log(peer);
|
|
232
232
|
// console.log({connected: peer.id, as: this._getPeerId(peer.id) });
|
|
233
233
|
// peer.on('peernet.data', async (message) => {
|
|
234
234
|
// const id = message.id
|
|
@@ -342,7 +342,6 @@ export default class Peernet {
|
|
|
342
342
|
const walk = async peer => {
|
|
343
343
|
const node = await this.prepareMessage(data)
|
|
344
344
|
let result = await peer.request(node.encoded)
|
|
345
|
-
console.log({result});
|
|
346
345
|
result = new Uint8Array(Object.values(result))
|
|
347
346
|
const proto = await protoFor(result)
|
|
348
347
|
if (proto.name !== 'peernet-dht-response') throw dhtError(proto.name)
|
|
@@ -690,13 +689,5 @@ export default class Peernet {
|
|
|
690
689
|
get Buffer() {
|
|
691
690
|
return Buffer
|
|
692
691
|
}
|
|
693
|
-
// async block(index) {
|
|
694
|
-
// const _values = []
|
|
695
|
-
// for (const peer of this.peers) {
|
|
696
|
-
// const value = await peer.request({type: 'block', index})
|
|
697
|
-
// console.log(value);
|
|
698
|
-
// }
|
|
699
|
-
//
|
|
700
|
-
// }
|
|
701
692
|
}
|
|
702
693
|
globalThis.Peernet = Peernet
|