Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2.0 to 2.2.1

45

core/localNetwork.js

@@ -15,2 +15,4 @@

}
if (!data.option.path)
data.option.path = '/'
if (data.type == "tcp") {

@@ -68,3 +70,3 @@ var server = net.createServer(function (localsocket) {

socket.terminate();
}
}
},

@@ -77,4 +79,2 @@ start: function () {

} else if (data.type == "http") {
if (!data.option.path)
data.option.path = '/'
const headers = create_header("HTTP/1.1 200 OK", data.option.headers, {

@@ -110,23 +110,20 @@ "Connection": "keep-alive",

var indhttp = buffer.indexOf('\r\n\r\n')
if (localsocket.rh != true) {
if (indhttp == -1)
return
else
localsocket.rh = true
}
if (indhttp != -1 && (buffer.subarray(0, 3) == "GET" || buffer.subarray(0, 4) == "POST")) {
var path = buffer.subarray(buffer.indexOf(' ') + 1, buffer.indexOf(' HTTP')).toString()
if (path == data.option.path) {
this.write(headers)
if (buffer.length != indhttp + 4) {
return remoteProtocol.message.call(this, buffer.subarray(indhttp + 4))
} else {
return
if (indhttp != -1) {
if (buffer.subarray(0, 3) == "GET" || buffer.subarray(0, 4) == "POST") {
var path = buffer.subarray(buffer.indexOf(' ') + 1, buffer.indexOf(' HTTP')).toString()
if (path == data.option.path) {
localsocket.rh = true
this.write(headers)
if (buffer.length != indhttp + 4) {
return remoteProtocol.message.call(this, buffer.subarray(indhttp + 4))
} else {
return
}
} else if (data.option.fake) {
this.write("HTTP/1.1 200 OK\r\n\r\n")
this.write(data.option.fake)
return this.end()
}
} else if (data.option.fake) {
this.write("HTTP/1.1 200 OK\r\n\r\n")
this.write(data.option.fake)
return this.end()
}
} else {
} else if (localsocket.rh == true) {
remoteProtocol.message.call(this, buffer)

@@ -145,8 +142,6 @@ }

log("http server is running on " + data.address + " port " + data.port, 1)
server.listen(data.port, data.address);
server.listen(data.port, data.address);
}
}
} else if (data.type == "httpAlt") {
if (!data.option.path)
data.option.path = '/'
const headers = create_header("HTTP/1.1 200 OK", data.option.headers, {

@@ -153,0 +148,0 @@ "Connection": "keep-alive",

@@ -15,2 +15,4 @@

}
if (!data.option.path)
data.option.path = '/'
if (data.type == "tcp") {

@@ -32,10 +34,5 @@ return function (address, port, option, remoteConnect, remoteMessage, remoteClose) {

return function (address, port, option, remoteConnect, remoteMessage, remoteClose) {
if (!option) {
option = {}
}
if (!option.path)
option.path = '/'
log("ws client connected to " + address + " port " + port, 2)
const remotesocket = new WebSocket('ws://' + address + ':' + port + option.path, {
headers: option.headers
const remotesocket = new WebSocket('ws://' + address + ':' + port + data.option.path, {
headers: data.option.headers
});

@@ -61,3 +58,3 @@ remotesocket.on('error', error);

} else if (data.type == "http") {
const headers = create_header("GET / HTTP/1.1", data.option.headers, {
const headers = create_header("GET " + data.option.path + " HTTP/1.1", data.option.headers, {
"Accept-Encoding": "gzip, deflate",

@@ -69,7 +66,2 @@ "Connection": "keep-alive",

return function (address, port, option, remoteConnect, remoteMessage, remoteClose) {
if (!option) {
option = {}
}
if (!option.path)
option.path = '/'
log("http client connected to " + address + " port " + port, 2)

@@ -96,2 +88,4 @@ const remotesocket = new net.Socket();

message: function (buffer) {
if (remotesocket.readyState == "closed")
return
if (remotesocket.rh != true) {

@@ -98,0 +92,0 @@ remotesocket.write(headers)

{
"name": "js2ray",
"version": "2.2.0",
"version": "2.2.1",
"description": "The v2ray vmess protocol, based on nodejs javascript which you can use on hosts and servers",

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

@@ -41,3 +41,3 @@

network.port,
network.option,
undefined,
localConnect,

@@ -44,0 +44,0 @@ DecodeResponseHeader.bind(app),

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