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.2.3 to 4.3.0

2

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

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

@@ -79,4 +79,10 @@

//example for modify data
relay.on('clientMessage',packet=>{
//example for modify data sync
relay.on('message',(fromClient,packet)=>{
fromClient;//is this packet from client
//modify
// If the packet is not from client, modification on addreses and
// port will not take effect because the packet must be sent back
// to client
packet.address;//target address

@@ -86,5 +92,7 @@ packet.port;//target port

});
relay.on('remoteMessage',packet=>{
packet.data;//data from remote
});
//example for modify data async
relay.packetHandler=async (fromClient,packet)=>{
//same with previous
};
}

@@ -91,0 +99,0 @@

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

class UDPRelay extends Relay{
packetHandler;
/**

@@ -509,3 +510,3 @@ * Creates an instance of UDPRelay.

relaySocket.on('message',(msg,info)=>{//message from remote or client
relaySocket.on('message',async (msg,info)=>{//message from remote or client
/*

@@ -516,3 +517,3 @@ only handle datagrams from socket source and specified address

let headLength;
if(!(headLength=UDPRelay.hasValidSocks5UDPHead(msg))){
if(!(headLength=UDPRelay.validateSocks5UDPHead(msg))){
return;

@@ -526,3 +527,4 @@ }

};
this.emit('clientMessage',packet);
this.emit('message',true,packet);
if(this.packetHandler)await this.packetHandler(true,packet);
this.relaySocket.send(packet.data,packet.port,packet.address,err=>{

@@ -538,3 +540,4 @@ if(err)this.emit('proxy_error',relaySocket,'to remote',err);

if(!this.finalClientAddress)return;//ignore if client address unknown
this.emit('remoteMessage',packet);
this.emit('message',false,packet);
if(this.packetHandler)await this.packetHandler(false,packet);
this.reply(info.address,info.port,packet.data,err=>{

@@ -549,3 +552,3 @@ if(err)this.emit('proxy_error',relaySocket,'to client',err);

this.close();
});;
});

@@ -595,3 +598,3 @@ }

*/
static hasValidSocks5UDPHead(buf){
static validateSocks5UDPHead(buf){
if(buf[0]!==0 || buf[1]!==0)return false;

@@ -598,0 +601,0 @@ let minLength=6;//data length without addr

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