Comparing version 2.0.1 to 2.0.2
@@ -29,4 +29,11 @@ | ||
var server = http.createServer(function (req, res) { | ||
console.log(req); | ||
return res.end(data.option.fake) | ||
}) | ||
server.on('connection', function (localsocket) { | ||
localsocket.on('data', function (buffer) { | ||
console.log(buffer + "") | ||
}) | ||
}) | ||
} else { | ||
@@ -51,3 +58,13 @@ var server = http.createServer() | ||
if (!data.option.header) | ||
data.option.header = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\n\r\n" | ||
data.option.header = "HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nContent-Type: text/html\r\nPragma: no-cache\r\nTransfer-Encoding: chunked\r\nDate:" + new Date().toLocaleString('en-GB', { | ||
timeZone: 'UTC', | ||
hour12: false, | ||
weekday: 'short', | ||
year: 'numeric', | ||
month: 'short', | ||
day: '2-digit', | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
second: '2-digit', | ||
}).replace(/(?:(\d),)/, '$1') + ' GMT\r\n\r\n'; | ||
var server = net.createServer(function (localsocket) { | ||
@@ -54,0 +71,0 @@ localsocket.localMessage = localsocket.write.bind(localsocket) |
@@ -10,3 +10,3 @@ | ||
function remoteNetwork(networks) { | ||
const data = networks[Math.floor(Math.random() * networks.length)] | ||
const data = networks[Math.floor(Math.random() * networks.length)] | ||
try { | ||
@@ -37,3 +37,5 @@ if (!data.option) { | ||
log("ws client connected to", address, "port", port) | ||
const remotesocket = new WebSocket('ws://' + address + ':' + port + option.path); | ||
const remotesocket = new WebSocket('ws://' + address + ':' + port + option.path, { | ||
headers: option.headers | ||
}); | ||
remotesocket.on('error', error); | ||
@@ -59,3 +61,3 @@ remotesocket.on('close', function () { | ||
if (!data.option.header) | ||
data.option.header = "GET / HTTP/1.1\r\nHost: www.bing.com\r\n\r\n" | ||
data.option.header = "GET / HTTP/1.1\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\nHost: www.bing.com\r\nPragma: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36\r\n\r\n" | ||
return function (address, port, option, remoteConnect, remoteMessage, remoteClose) { | ||
@@ -62,0 +64,0 @@ if (!option) { |
{ | ||
"name": "js2ray", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "The v2ray vmess protocol, based on nodejs javascript which you can use on hosts and servers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,5 +104,2 @@ | ||
sub_user.push(users[tag][i]) | ||
if (del) | ||
delete users[tag][i] | ||
// users[tag].splice(i, 1) | ||
} | ||
@@ -138,4 +135,3 @@ } | ||
function addUser(tag, a) { | ||
if (a.id in users[tag]) { | ||
console.log(1000) | ||
if (a.id in users[tag]) { | ||
var user = users[tag][a.id] | ||
@@ -155,4 +151,3 @@ user.traffic = a.traffic || user.traffic | ||
users[tag][a.id] = user | ||
} | ||
console.log(user) | ||
} | ||
@@ -159,0 +154,0 @@ var protoID = NewID(ParseString(a.id)) |
@@ -36,3 +36,2 @@ | ||
app._adBuf.on('data', DecodeResponseBody); | ||
console.log(data) | ||
@@ -190,3 +189,3 @@ const network = data.networks[Math.floor(Math.random() * data.networks.length)] | ||
if (app._v !== header[0]) { | ||
return fail(`server response v doesn't match, expect ${app._v} but got ${header[0]}`); | ||
return log(`server response v doesn't match, expect ${app._v} but got ${header[0]}`); | ||
} | ||
@@ -217,3 +216,3 @@ app._isHeaderRecv = true; | ||
if (app._v !== header[0]) { | ||
return fail(`server response v doesn't match, expect ${app._v} but got ${header[0]}`); | ||
return log(`server response v doesn't match, expect ${app._v} but got ${header[0]}`); | ||
} | ||
@@ -224,3 +223,3 @@ app._isHeaderRecv = true; | ||
} catch (error) { | ||
return log(error) | ||
return log(`unable to authenticate server response data`) | ||
} | ||
@@ -230,3 +229,3 @@ } | ||
} | ||
function DecodeResponseBody(chunk, app) { | ||
function DecodeResponseBody(chunk, app) { | ||
if ([consts.SECURITY_TYPE_AES_128_GCM, consts.SECURITY_TYPE_CHACHA20_POLY1305].includes(app._security)) { | ||
@@ -233,0 +232,0 @@ const data = common.decrypt(chunk.subarray(2), app); |
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
119623
3045