@outtacontrol/socks-router
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Universal Router

Easier way to add routing functionality on top of the socks5 webserver.

const { createServer } = require("@outtacontrol/socks");

const { createRouter } = require("./lib/index");
const { blacklist } = require("./lib/validators/blacklist");
// const { whitelist } = require("./lib/validators/blacklist");

const app = createRouter();

app.use(blacklist(['example1.com', 'example2.com:80']));
// app.use(whitelist(['example1.com', 'example2.com:80']));

// app.use({
//     uri: {hostname: "...", port: "8080"},
//
//     async initialize() {
//         // ... some initialization code (only executed once before an action takes place on the route)
//     },
//     async validate(info) {
//         // // no return or empty return is just continuing the loop
//         // return true; // executes the interception method
//         // return false; // denies access
//     },
//     asnyc intercept(info, socket) {
//         // do something with the socket...
//     }
// });

const server = createServer({ auths: [auth.None()] }, app.getHandler());
server.listen(1080, "localhost", () => {
    console.log("socks5 router is listening on port 1080");
});

Readme

Keywords

none

Package Sidebar

Install

npm i @outtacontrol/socks-router

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

45.6 kB

Total Files

81

Last publish

Collaborators

  • phoenix344