MCPcopy Index your code
hub / github.com/PeerViewer/codebase / startHyperTeleClient

Function startHyperTeleClient

src/main.js:354–470  ·  view source on GitHub ↗
(pubkeybase64)

Source from the content-addressed store, hash-verified

352
353
354function startHyperTeleClient(pubkeybase64) {
355
356console.log("Starting hypertele with pubkeybase64: " + pubkeybase64);
357
358let pubkeyhex = ""
359try {
360 pubkeyhex = new Buffer(pubkeybase64, 'base64').toString('hex');
361 if (pubkeyhex.length != 64) {
362 console.log("Pubkey invalid length - it should be 32 bytes. Returning...");
363 return;
364 }
365} catch (e) {
366 console.log("caught error during decode of base64 pubkey");
367 console.log(e);
368 return;
369}
370
371console.log("Starting hypertele with pubkeyhex: " + pubkeyhex);
372
373argv.s = pubkeyhex;
374argv.p = "45900";
375
376const helpMsg = 'Usage:\nhypertele -p port_listen -u unix_socket ?-c conf.json ?-i identity.json ?-s peer_key'
377
378if (argv.help) {
379 console.log(helpMsg)
380 process.exit(-1)
381}
382
383if (!argv.u && !+argv.p) {
384 console.error('Error: proxy port invalid')
385 process.exit(-1)
386}
387
388if (argv.u && argv.p) {
389 console.error('Error: cannot listen to both a port and a Unix domain socket')
390 process.exit(-1)
391}
392const conf = {}
393
394const target = argv.u ? argv.u : +argv.p
395
396if (argv.s) {
397 conf.peer = libUtils.resolveHostToKey([], argv.s)
398}
399
400if (argv.c) {
401 libUtils.readConf(conf, argv.c)
402}
403
404if (!conf.keepAlive) {
405 conf.keepAlive = 5000
406}
407
408if (argv.compress) {
409 conf.compress = true
410}
411

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected