@outtacontrol/socks-router
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
38946
699
33
1