Comparing version 2.3.8 to 2.3.9
{ | ||
"name": "js2ray", | ||
"version": "2.3.8", | ||
"version": "2.3.9", | ||
"description": "The v2ray vmess protocol, based on nodejs javascript which you can use on hosts and servers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ "use strict"; | ||
app._staging = Buffer.alloc(0) | ||
app._option = 0x05 | ||
// app._option = 0x05 | ||
app._cipherNonce = 0; | ||
@@ -69,4 +69,4 @@ app._decipherNonce = 0; | ||
app._isHeaderRecv = false; | ||
app._adBuf.clear(); | ||
if (app._adBuf) | ||
app._adBuf.clear(); | ||
app._adBuf = null; | ||
@@ -115,2 +115,4 @@ app._host = null; | ||
function EncodeRequestHeader(app, randomuser) { | ||
if (!app._host) | ||
return | ||
const rands = crypto.randomBytes(33); | ||
@@ -144,3 +146,2 @@ const [isAEAD, random_user, authInfo, ts] = randomuser(); | ||
app._v = rands[32]; | ||
app._option = 0x05; | ||
@@ -150,5 +151,12 @@ const paddingLen = getRandomInt(0, 15); | ||
app._security = app.user.security || 2 | ||
if (app.user.security == consts.SECURITY_TYPE_AUTO) { | ||
app._security = consts.SECURITY_TYPE_CHACHA20_POLY1305 | ||
app._option = 0x0D; | ||
} else if (app.user.security == consts.SECURITY_TYPE_ZERO) { | ||
app._security = consts.SECURITY_TYPE_NONE | ||
app._option = 0x00; | ||
} else { | ||
app._security = app.user.security || 2 | ||
app._option = 0x05; | ||
} | ||
if (app._security == consts.SECURITY_TYPE_CHACHA20_POLY1305) { | ||
@@ -302,3 +310,3 @@ app._dataEncKeyForChaCha20 = common.createChacha20Poly1305Key(app._dataEncKey); | ||
len = buffer.readUInt16BE(0); | ||
if (app._option >= 0x05) { | ||
if (app._option >= 0x05 && app._chunkLenDecMaskGenerator) { | ||
var pad = 0 | ||
@@ -305,0 +313,0 @@ if (app._option >= 0x08) { |
@@ -20,3 +20,2 @@ "use strict"; | ||
socket.app._staging = Buffer.alloc(0) | ||
socket.app._option = 0x05 | ||
socket.app._isConnecting = false; | ||
@@ -135,2 +134,3 @@ socket.app._isHeaderSent = false; | ||
const securityType = reqHeader[35] & 0x0F; | ||
app._security = securityType; | ||
if (!(aeadUser.security == 2 || aeadUser.security == undefined || securityType == 2) && securityType != aeadUser.security) { | ||
@@ -151,3 +151,3 @@ return onerror(app, `not match securety type`, 1); | ||
var port = 0 | ||
var addr = "v1.mux.cool" | ||
var addr = "localhost" | ||
var addrType = ATYP_DOMAIN | ||
@@ -205,3 +205,2 @@ } | ||
const data = buffer.subarray(dataoffset + plainReqHeader.length + 4); | ||
app._security = securityType; | ||
app._isConnecting = true; | ||
@@ -321,3 +320,2 @@ app.remote = remoteProtocol( | ||
function onReceivingLength(buffer, app) { | ||
var len = buffer.length | ||
@@ -331,3 +329,3 @@ if (len < 2) { | ||
var pad = 0 | ||
if (app._option >= 0x08) { | ||
if (app._option >= 0x08 && app._chunkLenDecMaskGenerator) { | ||
const padmask = app._chunkLenDecMaskGenerator.nextBytes(2).readUInt16BE(0); | ||
@@ -334,0 +332,0 @@ pad = (padmask % 64) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137776
3541