New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

socks5server

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socks5server - npm Package Compare versions

Comparing version 4.3.2 to 4.4.0

5

package.json
{
"name": "socks5server",
"version": "4.3.2",
"version": "4.4.0",
"description": "A simple SOCKS 5/4/4a implementation and demo proxy",

@@ -22,4 +22,5 @@ "author": "luojia <luojia@luojia.me>",

"commander": "^8.3.0",
"ip-address": "^8.1.0"
"ip-address": "^8.1.0",
"pump": "^3.0.0"
}
}

8

proxy.js

@@ -57,8 +57,4 @@

//example for modify data
relay.inStream=(source)=>{
return source;//return another Readable stream to modify the stream
}
relay.outStream=(source)=>{
return source;//return another Readable stream to modify the stream
}
relay.outModifier=null;//give a readable stream here to modify outgoing data
relay.inModifier=null;//give a readable stream here to modify incoming data
}

@@ -65,0 +61,0 @@

@@ -8,2 +8,3 @@ 'use strict'

stream=require('stream'),
pump = require('pump'),
ipAddress=require('ip-address');

@@ -463,2 +464,5 @@

this.emit('close');
setImmediate(()=>{
this.relaySocket=null;
});
}

@@ -550,3 +554,2 @@ }

});
}

@@ -588,2 +591,6 @@ /**

}
close(){
super.close();
this.packetHandler=null;
}
/**

@@ -619,2 +626,4 @@ *check socks5 UDP head

remotePort;
outModifier;//a readable stream for modifying outgoing stream
inModifier;//a readable stream for modifying incoming stream
/**

@@ -639,9 +648,13 @@ * Creates an instance of TCPRelay.

localPort:localPort||undefined
},CMD_REPLY);
});
relaySocket.on('connect',()=>{
CMD_REPLY(SOCKS_REPLY.SUCCEEDED,this.localAddress,this.localPort);
this.inStream(relaySocket).pipe(socket);
this.outStream(socket).pipe(relaySocket);
this.emit('connection',this.inStream(socket),relaySocket);
let outChain=[socket,relaySocket];
if(this.outModifier)outChain.splice(1,0,this.outModifier);
pump(outChain);
let inChain=[relaySocket,socket];
if(this.inModifier)inChain.splice(1,0,this.inModifier);
pump(inChain);
this.emit('connection',socket,relaySocket);
}).once('error',err=>{

@@ -658,2 +671,3 @@ let rep=SOCKS_REPLY.SERVER_FAILURE;

this.emit('proxy_error',err,socket,relaySocket);
this.close();
}).once('close',()=>{

@@ -663,20 +677,9 @@ this.close();

}
/**
*get incoming stream and return a stream, can be used to modify incoming stream
*
* @param {stream.Readable} source
* @returns {stream.Readable}
*/
inStream(source){
return source;
close(){
super.close();
this.inModifier=null;
this.outModifier=null;
this.packetHandler=null;
this.socket=null;
}
/**
*get out going stream and return a stream, can be used to modify out going stream
*
* @param {stream.Readable} source
* @returns {stream.Readable}
*/
outStream(source){
return source;
}
}

@@ -683,0 +686,0 @@

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