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

mole-proxy

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mole-proxy - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "mole-proxy",
"version": "1.0.3",
"version": "1.0.4",
"description": "Proxy listen ports. Go through NAT.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -96,7 +96,7 @@ const dgram = require('dgram');

if (mark == 4) {
var data = new Buffer(msg.length - 7);
msg.copy(data, 0, 7, msg.length);
conn.peerData(msg[6], data);
var data = new Buffer(msg.length - 8);
msg.copy(data, 0, 8, msg.length);
conn.peerData(msg.readUInt16LE(6), data);
} else {
conn.ack(msg[6]);
conn.ack(msg.readUInt16LE(6));
}

@@ -159,2 +159,7 @@ } else {

const WindowSize = 1000;
const PackIdSize = 65530;
const AcceptLost = 10;
class Connection extends EventEmitter {

@@ -174,2 +179,3 @@ constructor() {

this.timestamp = Date.now();
this.resendDelay = 200;
}

@@ -188,11 +194,19 @@ beat() {

} else {
var waterMark = Date.now() - 800;
console.log(this.resendDelay);
var waterMark = Date.now() - this.resendDelay;
var lost = 0;
for (var i = this.benchWndStart; i != this.benchWndEnd; i = this._nextPtr(i)) {
var item = this.ackBench[i];
if (item.timestamp < waterMark) {
if (item && item.timestamp < waterMark) {
lost++;
item.retry++;
item.timestamp = Date.now() + 500 * item.retry;
item.timestamp = Date.now();
this.resendDelay += 30;
this._sendPack(i);
}
}
if (lost < AcceptLost) {
this.resendDelay = Math.ceil(this.resendDelay * 0.7);
this.resendDelay = Math.max(200, Math.min(1500, this.resendDelay));
}
}

@@ -224,7 +238,7 @@ }

peerData(packId, data) {
var sendBuffer = new Buffer(7);
var sendBuffer = new Buffer(8);
signHeader.copy(sendBuffer, 0, 0, 4);
sendBuffer[4] = 5;
sendBuffer[5] = this.connId;
sendBuffer[6] = packId;
sendBuffer.writeUInt16LE(packId, 6);
this._send(sendBuffer);

@@ -234,5 +248,5 @@

if (diff < 0) {
diff += 250;
diff += PackIdSize;
}
if (diff > 100) {
if (diff > WindowSize) {
// console.log('dispose', packId);

@@ -295,3 +309,3 @@ return;

}
while (this.pendingQueue.length && this._benchLen() < 100) {
while (this.pendingQueue.length && this._benchLen() < WindowSize) {
this.ackBench[this.benchWndEnd] = {

@@ -308,8 +322,8 @@ data: this.pendingQueue.shift(),

var dataBuffer = this.ackBench[packId].data;
var sendBuffer = new Buffer(dataBuffer.length + 7);
var sendBuffer = new Buffer(dataBuffer.length + 8);
signHeader.copy(sendBuffer, 0, 0, 4);
sendBuffer[4] = 4;
sendBuffer[5] = this.connId;
sendBuffer[6] = packId;
dataBuffer.copy(sendBuffer, 7, 0, dataBuffer.length);
sendBuffer.writeUInt16LE(packId, 6);
dataBuffer.copy(sendBuffer, 8, 0, dataBuffer.length);
this._send(sendBuffer);

@@ -322,3 +336,3 @@ }

num++;
if (num >= 250) {
if (num >= PackIdSize) {
num = 0;

@@ -331,3 +345,3 @@ }

if (ret < 0) {
ret += 250;
ret += PackIdSize;
}

@@ -334,0 +348,0 @@ return ret;

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