Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@outtacontrol/socks-router

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@outtacontrol/socks-router - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

34

example.js

@@ -1,23 +0,27 @@

const { auth, createServer, through, blacklist, whitelist } = require("./index");
const { createServer } = require("@outtacontrol/socks");
const server = createServer([
const { createRouter } = require("./lib/index");
const { blacklist } = require("./lib/validators/blacklist");
// const { whitelist } = require("./lib/validators/blacklist");
// deny every domains in the blacklist (specify with port)
blacklist(['example1.com', 'example2.com:80']),
const app = createRouter();
// // deny every domains not in the whitelist (specify with port)
// whitelist(['example1.com', 'example2.com:80']),
app.use(blacklist(['example1.com', 'example2.com:80']));
// app.use(whitelist(['example1.com', 'example2.com:80']));
// only routing connections with destination port 443
through(443),
// app.use({
// uri: {hostname: "...", port: "8080"},
// validate(info) {
// // // no return or empty return is just continuing the loop
// // return true; // executes the interception method
// // return false; // denies access
// },
// execute(info, socket) {
// // do something with the socket...
// }
// });
// only routing connections with destination port 80
through(80),
// routing connection for any destination port
through('any')
], { auths: [auth.None()] });
const server = createServer({ auths: [auth.None()] }, app.getHandler());
server.listen(1080, "localhost", () => {
console.log("socks5 router is listening on port 1080");
});

@@ -8,3 +8,4 @@ "use strict";

const addrname = '.' + info.dstAddr;
if (addrname.lastIndexOf(hostname) < 0) {
const index = addrname.lastIndexOf(hostname);
if (index < 0 || addrname.slice(index).length > hostname.length) {
return false;

@@ -11,0 +12,0 @@ }

{
"name": "@outtacontrol/socks-router",
"version": "1.0.0",
"version": "1.0.1",
"description": "routes requests on the socks v5 server.",

@@ -22,3 +22,10 @@ "main": "lib/index.js",

"license": "MIT",
"repository": {
"type": "git",
"url": ""
},
"dependencies": {},
"optionalDependencies": {
"@outtacontrol/socks": "^1.0.3"
},
"devDependencies": {

@@ -25,0 +32,0 @@ "@types/node": "^10.7.0",

# Universal Router
A wrapper on top of the socksv5 server to attach multiple components more easily
Easier way to add routing functionality on top of the socks5 webserver.
```javascript
const { auth, createServer, routeThrough, blacklist, whitelist } = require("universal-router");
const { createServer } = require("@outtacontrol/socks");
// es6/typescript compatible
// import { auth, createServer, routeThrough, blacklist, whitelist } from "universal-router";
const { createRouter } = require("./lib/index");
const { blacklist } = require("./lib/validators/blacklist");
// const { whitelist } = require("./lib/validators/blacklist");
const server = createServer([
const app = createRouter();
// deny every domains in the blacklist (specify with port)
blacklist(['example1.com', 'example2.com:80']),
app.use(blacklist(['example1.com', 'example2.com:80']));
// app.use(whitelist(['example1.com', 'example2.com:80']));
// // deny every domains not in the whitelist (specify with port)
// whitelist(['example1.com', 'example2.com:80']),
// app.use({
// uri: {hostname: "...", port: "8080"},
// validate(info) {
// // // no return or empty return is just continuing the loop
// // return true; // executes the interception method
// // return false; // denies access
// },
// execute(info, socket) {
// // do something with the socket...
// }
// });
// only routing connections with destination port 443
routeThrough(443),
// only routing connections with destination port 80
routeThrough(80),
// routing connection for any destination port
routeThrough('any')
], { auths: [auth.None()] });
const server = createServer({ auths: [auth.None()] }, app.getHandler());
server.listen(1080, "localhost", () => {

@@ -29,0 +30,0 @@ console.log("socks5 router is listening on port 1080");

@@ -9,3 +9,4 @@ import { SocksProxyInfo } from "../interfaces/SocksProxyInfo";

const addrname = '.' + info.dstAddr;
if (addrname.lastIndexOf(hostname) < 0) {
const index = addrname.lastIndexOf(hostname);
if (index < 0 || addrname.slice(index).length > hostname.length) {
return false;

@@ -12,0 +13,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc