@yz-social/kdht 0.1.11 → 0.1.12
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/package.json +2 -1
- package/portals/node.js +1 -1
- package/spec/bots.js +1 -1
- package/transports/webrtc.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yz-social/kdht",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Pure Kademlia base, for testing variations.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"start": "node spec/portal.js --externalBaseURL https://ki1r0y.com/kdht",
|
|
13
13
|
"stop": "pkill kdht",
|
|
14
14
|
"background": "npm stop; (npm start 1>server.log 2>&1 &); sleep 1",
|
|
15
|
+
"withoutExternal": "node spec/portal.js",
|
|
15
16
|
"bots": "node spec/bots.js",
|
|
16
17
|
"thrashbots": "node spec/bots.js --thrash",
|
|
17
18
|
"testWebrtc": "npx jasmine spec/testWebrtc.js",
|
package/portals/node.js
CHANGED
|
@@ -3,7 +3,7 @@ import cluster from 'node:cluster';
|
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { WebContact, Node } from '../index.js';
|
|
5
5
|
|
|
6
|
-
export async function setup({baseURL, externalBaseURL = '', debug, fixedSpacing,
|
|
6
|
+
export async function setup({baseURL, externalBaseURL = '', info = true, debug, fixedSpacing, variableSpacing}) {
|
|
7
7
|
const hostName = uuidv4();
|
|
8
8
|
process.title = 'kdht-portal-' + hostName;
|
|
9
9
|
// For debugging:
|
package/spec/bots.js
CHANGED
|
@@ -17,7 +17,7 @@ const argv = yargs(hideBin(process.argv))
|
|
|
17
17
|
alias: 'n',
|
|
18
18
|
alias: 'nbots',
|
|
19
19
|
type: 'number',
|
|
20
|
-
default: logicalCores,
|
|
20
|
+
default: Math.max(2, logicalCores / 2),
|
|
21
21
|
description: "The number of bots, which can only be reached through the network."
|
|
22
22
|
})
|
|
23
23
|
.option('baseURL', {
|
package/transports/webrtc.js
CHANGED
|
@@ -67,6 +67,14 @@ export class WebContact extends Contact { // Our wrapper for the means of contac
|
|
|
67
67
|
this.closed = promise;
|
|
68
68
|
const webrtc = this.webrtc = new WebRTC({name: this.webrtcLabel,
|
|
69
69
|
debug: host.debug,
|
|
70
|
+
configuration: {iceServers: [
|
|
71
|
+
{urls: [
|
|
72
|
+
'stun:stun1.l.google.com:19302',
|
|
73
|
+
'stun:stun2.l.google.com:19302',
|
|
74
|
+
'stun:stun3.l.google.com:19302',
|
|
75
|
+
'stun:stun4.l.google.com:19302'
|
|
76
|
+
]},
|
|
77
|
+
]},
|
|
70
78
|
polite: this.host.key < this.node.key});
|
|
71
79
|
const onclose = () => { // Does NOT mean that the far side has gone away. It could just be over maxTransports.
|
|
72
80
|
this.host.log('connection closed');
|