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

Function startHyperTeleServer

src/main.js:255–351  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253const connPiper = libNet.connPiper
254
255function startHyperTeleServer() {
256
257argv.l = "55900";
258argv.seed = libKeys.randomBytes(32).toString('hex');
259
260const helpMsg = 'Usage:\nhypertele-server -l service_port -u unix_socket ?--address service_address ?-c conf.json ?--seed seed ?--cert-skip'
261
262if (argv.help) {
263 console.log(helpMsg)
264 process.exit(-1)
265}
266
267if (!argv.u && !+argv.l) {
268 console.error('Error: proxy port invalid')
269 process.exit(-1)
270}
271
272if (argv.u && argv.l) {
273 console.error('Error: cannot listen to both a port and a Unix domain socket')
274 process.exit(-1)
275}
276
277const conf = {}
278
279if (argv.seed) {
280 conf.seed = argv.seed
281}
282
283if (argv.c) {
284 libUtils.readConf(conf, argv.c)
285}
286
287if (argv.compress) {
288 conf.compress = true
289}
290
291if (argv['cert-skip']) {
292 process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
293}
294
295if (!conf.seed) {
296 console.error('Error: conf.seed invalid')
297 process.exit(-1)
298}
299
300if (conf.allow) {
301 conf.allow = libKeys.prepKeyList(conf.allow)
302}
303
304const debug = argv.debug
305
306const seed = Buffer.from(conf.seed, 'hex')
307
308const dht = new HyperDHT()
309const keyPair = HyperDHT.keyPair(seed)
310
311const stats = {}
312

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected