3.5.1 • Published 10 months ago

noctua-vulture v3.5.1

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

noctua-vulture

noctua man in the middle

TIPS: for enabling debugging need to set environment variable VULTURE_DEBUG=true

EASY START:

import cluster from 'cluster';
import { availableParallelism } from 'node:os';
import process from 'node:process';
import { NoctuaVulture } from "noctua-vulture";
const numCPUs = availableParallelism();
const numThreads = numCPUs * 2;
if (cluster.isPrimary) {
    console.log(`Primary PID ${process.pid} is running, detected ${numCPUs} cpus, starting ${numThreads} threads...`);
    for (let i = 0; i < numThreads; i++) cluster.fork({THREAD_NUM:i});
    cluster.on('exit', (worker, code, signal) => { console.log(`thread PID ${worker.process.pid} died`,code,signal); });
} else {
    const server : NoctuaVulture = new NoctuaVulture();
    server.onRequest((ctx,callback)=>{
        let info = ctx.proxyToServerRequestOptions;
        if (info) console.log(info.method,info.host,info.port,info.path);
        callback();
    });
    server.onError((ctx,err,errorKind)=>{
        console.log(`Thread [${process.env.THREAD_NUM}] PID ${process.pid}`,ctx?.clientToProxyRequest.url,err,errorKind);
    })
    server.listen({host:"127.0.0.1",port:1982});
    console.log(`Thread [${process.env.THREAD_NUM}] PID ${process.pid} started`);
}
3.3.0

10 months ago

3.2.0

10 months ago

3.1.1

10 months ago

3.0.2

10 months ago

3.1.0

10 months ago

3.0.1

10 months ago

3.2.5

10 months ago

3.5.1

10 months ago

3.5.0

10 months ago

3.0.0

10 months ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago