Add bootstrap files
This commit is contained in:
2
deno_bootstrap/compile.sh
Executable file
2
deno_bootstrap/compile.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
deno compile --allow-scripts --allow-all --no-check ddln_bootstrap.ts
|
||||
BIN
deno_bootstrap/ddln_bootstrap
Executable file
BIN
deno_bootstrap/ddln_bootstrap
Executable file
Binary file not shown.
58
deno_bootstrap/ddln_bootstrap.ts
Normal file
58
deno_bootstrap/ddln_bootstrap.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { PeerManager } from "../src/PeerManager.ts";
|
||||
import { generateID } from "IDUtils";
|
||||
import nodeDataChannel from 'npm:node-datachannel';
|
||||
import nodeDatachannelPolyfill from 'npm:node-datachannel/polyfill';
|
||||
|
||||
nodeDataChannel.initLogger('Info');
|
||||
|
||||
// import {RTCPeerConnection} from 'npm:node-datachannel/polyfill';
|
||||
|
||||
// deno install --allow-scripts=npm:node-datachannel --entrypoint ddln_bootstrap.ts
|
||||
// constructor(userID: string, peerID: string, isBootstrapPeer: boolean) {
|
||||
|
||||
declare type ID = string;
|
||||
|
||||
interface Config {
|
||||
userID:ID
|
||||
peerID:ID
|
||||
}
|
||||
|
||||
let configJSON;
|
||||
let config:Config;
|
||||
let configFilename = 'ddln_bootstrap_config.json';
|
||||
try {
|
||||
configJSON = Deno.readTextFileSync(configFilename);
|
||||
config = JSON.parse(configJSON) as Config;
|
||||
console.log("Loaded config file: ", config);
|
||||
} catch (e) {
|
||||
console.log("Config file not found, creating...");
|
||||
const initialConfig = {
|
||||
userID: generateID(),
|
||||
peerID: generateID()
|
||||
};
|
||||
|
||||
console.log(initialConfig);
|
||||
|
||||
Deno.writeTextFileSync(configFilename, JSON.stringify(initialConfig));
|
||||
|
||||
config = initialConfig;
|
||||
}
|
||||
|
||||
// Polyfill RTCPeerConnection and friends
|
||||
const global = (globalThis as any);
|
||||
for (const [functionName, func] of Object.entries(nodeDatachannelPolyfill)) {
|
||||
global[functionName] = func;
|
||||
}
|
||||
|
||||
console.log("ddln bootstrap peer starting...");
|
||||
|
||||
// console.log(nodeDatachannelPolyfill);
|
||||
|
||||
const isBootstrapPeer = true;
|
||||
const peerManager = new PeerManager(config.userID, config.peerID, isBootstrapPeer);
|
||||
|
||||
peerManager.registerRPC('announceUsers', (sendingPeerID: string, userIDs: string[]) => {
|
||||
console.log(`Got announceUsers from ${sendingPeerID} ${userIDs}`);
|
||||
});
|
||||
|
||||
peerManager.connect();
|
||||
1
deno_bootstrap/ddln_bootstrap_config.json
Normal file
1
deno_bootstrap/ddln_bootstrap_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"userID":"90d9c0ac-3768-43b2-9546-1e8eb345e001","peerID":"709a4859-49dc-4281-a55c-3f1fdbc1c763"}
|
||||
11
deno_bootstrap/deno.json
Normal file
11
deno_bootstrap/deno.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"imports": {
|
||||
"log": "../src/log.ts",
|
||||
"IDUtils": "../src/IDUtils.ts",
|
||||
"App": "../src/App.ts"
|
||||
},
|
||||
"nodeModulesDir": "auto",
|
||||
"lock": {
|
||||
"frozen": true
|
||||
}
|
||||
}
|
||||
207
deno_bootstrap/deno.lock
generated
Normal file
207
deno_bootstrap/deno.lock
generated
Normal file
@@ -0,0 +1,207 @@
|
||||
{
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"npm:@types/node@*": "22.15.15",
|
||||
"npm:node-datachannel@*": "0.26.0"
|
||||
},
|
||||
"npm": {
|
||||
"@types/node@22.15.15": {
|
||||
"integrity": "sha512-R5muMcZob3/Jjchn5LcO8jdKwSCbzqmPB6ruBxMcf9kbxtniZHP327s6C37iOfuw8mbKK3cAQa7sEl7afLrQ8A==",
|
||||
"dependencies": [
|
||||
"undici-types"
|
||||
]
|
||||
},
|
||||
"base64-js@1.5.1": {
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bl@4.1.0": {
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dependencies": [
|
||||
"buffer",
|
||||
"inherits",
|
||||
"readable-stream"
|
||||
]
|
||||
},
|
||||
"buffer@5.7.1": {
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"dependencies": [
|
||||
"base64-js",
|
||||
"ieee754"
|
||||
]
|
||||
},
|
||||
"chownr@1.1.4": {
|
||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||
},
|
||||
"decompress-response@6.0.0": {
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dependencies": [
|
||||
"mimic-response"
|
||||
]
|
||||
},
|
||||
"deep-extend@0.6.0": {
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
|
||||
},
|
||||
"detect-libc@2.0.4": {
|
||||
"integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA=="
|
||||
},
|
||||
"end-of-stream@1.4.4": {
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dependencies": [
|
||||
"once"
|
||||
]
|
||||
},
|
||||
"expand-template@2.0.3": {
|
||||
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="
|
||||
},
|
||||
"fs-constants@1.0.0": {
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||
},
|
||||
"github-from-package@0.0.0": {
|
||||
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="
|
||||
},
|
||||
"ieee754@1.2.1": {
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"inherits@2.0.4": {
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"ini@1.3.8": {
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||
},
|
||||
"mimic-response@3.1.0": {
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="
|
||||
},
|
||||
"minimist@1.2.8": {
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
|
||||
},
|
||||
"mkdirp-classic@0.5.3": {
|
||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||
},
|
||||
"napi-build-utils@2.0.0": {
|
||||
"integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="
|
||||
},
|
||||
"node-abi@3.74.0": {
|
||||
"integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==",
|
||||
"dependencies": [
|
||||
"semver"
|
||||
]
|
||||
},
|
||||
"node-datachannel@0.26.0": {
|
||||
"integrity": "sha512-i9ZcFNszK1HeV6Ym2AoQokmRHE5jk0L5023CdRLzbQl8rqyjJkOGecMxEjo1WSjNHDvRO3I3ay9waclBdD3jRQ==",
|
||||
"dependencies": [
|
||||
"prebuild-install"
|
||||
],
|
||||
"scripts": true
|
||||
},
|
||||
"once@1.4.0": {
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": [
|
||||
"wrappy"
|
||||
]
|
||||
},
|
||||
"prebuild-install@7.1.3": {
|
||||
"integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
|
||||
"dependencies": [
|
||||
"detect-libc",
|
||||
"expand-template",
|
||||
"github-from-package",
|
||||
"minimist",
|
||||
"mkdirp-classic",
|
||||
"napi-build-utils",
|
||||
"node-abi",
|
||||
"pump",
|
||||
"rc",
|
||||
"simple-get",
|
||||
"tar-fs",
|
||||
"tunnel-agent"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"pump@3.0.2": {
|
||||
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
|
||||
"dependencies": [
|
||||
"end-of-stream",
|
||||
"once"
|
||||
]
|
||||
},
|
||||
"rc@1.2.8": {
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"dependencies": [
|
||||
"deep-extend",
|
||||
"ini",
|
||||
"minimist",
|
||||
"strip-json-comments"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"readable-stream@3.6.2": {
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dependencies": [
|
||||
"inherits",
|
||||
"string_decoder",
|
||||
"util-deprecate"
|
||||
]
|
||||
},
|
||||
"safe-buffer@5.2.1": {
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"semver@7.7.1": {
|
||||
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
|
||||
"bin": true
|
||||
},
|
||||
"simple-concat@1.0.1": {
|
||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="
|
||||
},
|
||||
"simple-get@4.0.1": {
|
||||
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
||||
"dependencies": [
|
||||
"decompress-response",
|
||||
"once",
|
||||
"simple-concat"
|
||||
]
|
||||
},
|
||||
"string_decoder@1.3.0": {
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": [
|
||||
"safe-buffer"
|
||||
]
|
||||
},
|
||||
"strip-json-comments@2.0.1": {
|
||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="
|
||||
},
|
||||
"tar-fs@2.1.2": {
|
||||
"integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==",
|
||||
"dependencies": [
|
||||
"chownr",
|
||||
"mkdirp-classic",
|
||||
"pump",
|
||||
"tar-stream"
|
||||
]
|
||||
},
|
||||
"tar-stream@2.2.0": {
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"dependencies": [
|
||||
"bl",
|
||||
"end-of-stream",
|
||||
"fs-constants",
|
||||
"inherits",
|
||||
"readable-stream"
|
||||
]
|
||||
},
|
||||
"tunnel-agent@0.6.0": {
|
||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||
"dependencies": [
|
||||
"safe-buffer"
|
||||
]
|
||||
},
|
||||
"undici-types@6.21.0": {
|
||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="
|
||||
},
|
||||
"util-deprecate@1.0.2": {
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"wrappy@1.0.2": {
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
2
deno_bootstrap/dev.sh
Executable file
2
deno_bootstrap/dev.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
deno --allow-scripts --allow-all ddln_bootstrap.ts
|
||||
Reference in New Issue
Block a user