Socket
Socket
Sign inDemoInstall

@lakam99/socks

Package Overview
Dependencies
104
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.1

8

index.d.ts

@@ -102,2 +102,10 @@ import { JaxonSSLConfig } from '../jax.on/src/jax.on';

/**
* Retrieves the IP address of the remote end of a WebSocket connection.
*
* @param {WebSocket} socket - The WebSocket instance.
* @returns {string} The IP address of the remote end of the WebSocket connection.
*/
export function getSocketIp(socket: WebSocket): string;
export declare class SocksServer {

@@ -104,0 +112,0 @@ /**

2

package.json

@@ -6,3 +6,3 @@ {

"main": "socks.js",
"version": "0.4.0",
"version": "0.4.1",
"devDependencies": {

@@ -9,0 +9,0 @@ "@types/cookie-parser": "^1.4.3",

@@ -31,3 +31,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SocksServer = exports.SockPage = exports.getRequesterIp = exports.monitor_prop = exports.SockMessageType = void 0;
exports.SocksServer = exports.SockPage = exports.getSocketIp = exports.getRequesterIp = exports.monitor_prop = exports.SockMessageType = void 0;
const fs_1 = require("fs");

@@ -82,2 +82,3 @@ const ws_1 = require("ws");

}
exports.getSocketIp = getSocketIp;
class SockPage {

@@ -187,6 +188,6 @@ constructor(socket = undefined, socks) {

const existingSesh = this.get_sesh(getSocketIp(socket));
if (!existingSesh)
throw 'No sesh matching ip ' + getSocketIp(socket);
existingSesh?.currentPage.page.connect(socket);
socket.on('close', () => {
//TODO: implement
});
socket.on('close', this.remove_sesh(existingSesh, true));
});

@@ -247,2 +248,12 @@ this.initPages();

}
remove_sesh(sesh, return_func = false) {
const index = $SESSIONS.indexOf(sesh);
if (return_func) {
return () => $SESSIONS.splice(index, 1);
}
else {
$SESSIONS.splice(index, 1);
return () => void 0;
}
}
get_sesh(ip = "") {

@@ -249,0 +260,0 @@ return $SESSIONS.find((sesh) => sesh.ip === ip);

@@ -73,3 +73,3 @@ import {Application, static as _static} from 'express';

function getSocketIp(socket: WebSocket): string {
export function getSocketIp(socket: WebSocket): string {
return (socket as any)._socket.remoteAddress;

@@ -262,13 +262,20 @@ }

const existingSesh = this.get_sesh(getSocketIp(socket));
if (!existingSesh) throw 'No sesh matching ip ' + getSocketIp(socket);
existingSesh?.currentPage.page.connect(socket);
socket.on('close', this.remove_sesh(existingSesh, true));
});
socket.on('close', () => {
//TODO: implement
});
}
);
this.initPages();
}
private remove_sesh(sesh: SockSesh, return_func: boolean = false): (this: WebSocket, ...args: any[]) => void {
const index = $SESSIONS.indexOf(sesh);
if (return_func) {
return () => $SESSIONS.splice(index, 1);
} else {
$SESSIONS.splice(index, 1);
return () => void 0;
}
}
protected get_sesh(ip: string = ""): SockSesh | undefined {

@@ -275,0 +282,0 @@ return $SESSIONS.find((sesh: SockSesh) => sesh.ip === ip);

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc