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

js2ray

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js2ray - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

3

package.json
{
"name": "js2ray",
"version": "2.1.1",
"version": "2.1.2",
"description": "The v2ray vmess protocol, based on nodejs javascript which you can use on hosts and servers",

@@ -29,5 +29,4 @@ "main": "index.js",

"dependencies": {
"cuckoo-filter": "^1.1.4",
"ws": "^8.12.0"
}
}

@@ -40,28 +40,3 @@

function unix() {
return Math.round(new Date() / 1000)
}
function Match(AuthIDDecoderHolder, authID) {
for (var v in AuthIDDecoderHolder.decoders) {
var decode = Decode(AuthIDDecoderHolder.decoders[v].dec, authID)
if (decode.z != CRC32(decode.d.subarray(0, 12))) {
continue
}
if (decode.t < 0) {
continue
}
if (Math.abs(Number(decode.t) - unix()) > 120) {
continue
}
if (!antireplay.Check(AuthIDDecoderHolder.filter, authID)) {
return false
}
return AuthIDDecoderHolder.decoders[v].ticket
}
return undefined
}
function OpenVMessAEADHeader(key, data) {

@@ -160,3 +135,28 @@ var authid = data.subarray(0, 16)

function unix() {
return Math.round(new Date() / 1000)
}
function Match(AuthIDDecoderHolder, authID) {
for (var v in AuthIDDecoderHolder.decoders) {
var decode = Decode(AuthIDDecoderHolder.decoders[v].dec, authID)
if (decode.z != CRC32(decode.d.subarray(0, 12))) {
continue
}
if (decode.t < 0) {
continue
}
if (Math.abs(Number(decode.t) - unix()) > 120) {
continue
}
if (!antireplay.Check(AuthIDDecoderHolder.filter, authID)) {
return false
}
return AuthIDDecoderHolder.decoders[v].ticket
}
return undefined
}
// ====================================================== FUNCTIONS

@@ -163,0 +163,0 @@

const CuckooFilter = require('cuckoo-filter').CuckooFilter
const replayFilterCapacity = 100000
function InsertUnique(cf, data) {
if (cf.contains(data)) {
if (cf.has(data)) {
return false
}
return cf.add(data)
cf.add(data)
return true
}
function NewReplayFilter(interval) {
return {
poolA: [],
poolB: [],
poolA: new Set(),
poolB: new Set(),
poolSwap: false,
lastSwap: 0,
lastSwap: Math.round(new Date() / 1000),
interval: interval
}
}
// Check determines if there are duplicate records.
function Check(filter, sum) {
var now = Math.round(new Date() / 1000)
if (filter.lastSwap == 0) {
filter.lastSwap = now
filter.poolA = new CuckooFilter(replayFilterCapacity, 2, 4)
filter.poolB = new CuckooFilter(replayFilterCapacity, 2, 4)
}
if (now - filter.lastSwap >= filter.Interval) {
if (now - filter.lastSwap >= 5) {
console.log(100000)
if (filter.poolSwap) {
filter.poolA = new CuckooFilter(replayFilterCapacity, 2, 4)
filter.poolA.clear()
} else {
filter.poolB = new CuckooFilter(replayFilterCapacity, 2, 4)
filter.poolB.clear()
}

@@ -39,3 +31,2 @@ filter.poolSwap = !filter.poolSwap

}
return InsertUnique(filter.poolA, sum) && InsertUnique(filter.poolB, sum)

@@ -42,0 +33,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