This commit is contained in:
lightings 2023-07-06 11:59:39 +08:00
parent 0f34c40d1f
commit 5be7d0e305
25 changed files with 42209 additions and 54 deletions

View File

@ -0,0 +1,17 @@
var Code = require("shared/code");
var dispatcher = require("../../../util/dispatcher");
module.exports = function (app) {
return new Handler(app);
}
var Handler = function (app) {
this.app = app;
}
var handler = Handler.prototype;
handler.push = async function (msg, session, next) {
next(null, { code: Code.OK });
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
{
"clock": {
"hrtime": [
665284,
194010750
],
"unixtime": 1688528223598
},
"nodeVersions": {
"node": "18.16.0",
"acorn": "8.8.2",
"ada": "1.0.4",
"ares": "1.19.0",
"brotli": "1.0.9",
"cldr": "42.0",
"icu": "72.1",
"llhttp": "6.0.10",
"modules": "108",
"napi": "8",
"nghttp2": "1.52.0",
"nghttp3": "0.7.0",
"ngtcp2": "0.8.1",
"openssl": "3.0.8+quic",
"simdutf": "3.2.2",
"tz": "2022g",
"undici": "5.21.0",
"unicode": "15.0",
"uv": "1.44.2",
"uvwasi": "0.0.15",
"v8": "10.2.154.26-node.26",
"zlib": "1.2.13"
},
"toolVersion": "11.0.0"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
{
"clock": {
"hrtime": [
665326,
171345541
],
"unixtime": 1688528265576
},
"nodeVersions": {
"node": "18.16.0",
"acorn": "8.8.2",
"ada": "1.0.4",
"ares": "1.19.0",
"brotli": "1.0.9",
"cldr": "42.0",
"icu": "72.1",
"llhttp": "6.0.10",
"modules": "108",
"napi": "8",
"nghttp2": "1.52.0",
"nghttp3": "0.7.0",
"ngtcp2": "0.8.1",
"openssl": "3.0.8+quic",
"simdutf": "3.2.2",
"tz": "2022g",
"undici": "5.21.0",
"unicode": "15.0",
"uv": "1.44.2",
"uvwasi": "0.0.15",
"v8": "10.2.154.26-node.26",
"zlib": "1.2.13"
},
"toolVersion": "11.0.0"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
{
"clock": {
"hrtime": [
669951,
497289458
],
"unixtime": 1688532890919
},
"nodeVersions": {
"node": "18.16.0",
"acorn": "8.8.2",
"ada": "1.0.4",
"ares": "1.19.0",
"brotli": "1.0.9",
"cldr": "42.0",
"icu": "72.1",
"llhttp": "6.0.10",
"modules": "108",
"napi": "8",
"nghttp2": "1.52.0",
"nghttp3": "0.7.0",
"ngtcp2": "0.8.1",
"openssl": "3.0.8+quic",
"simdutf": "3.2.2",
"tz": "2022g",
"undici": "5.21.0",
"unicode": "15.0",
"uv": "1.44.2",
"uvwasi": "0.0.15",
"v8": "10.2.154.26-node.26",
"zlib": "1.2.13"
},
"toolVersion": "11.0.0"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
{
"clock": {
"hrtime": [
670166,
597122666
],
"unixtime": 1688533106069
},
"nodeVersions": {
"node": "18.16.0",
"acorn": "8.8.2",
"ada": "1.0.4",
"ares": "1.19.0",
"brotli": "1.0.9",
"cldr": "42.0",
"icu": "72.1",
"llhttp": "6.0.10",
"modules": "108",
"napi": "8",
"nghttp2": "1.52.0",
"nghttp3": "0.7.0",
"ngtcp2": "0.8.1",
"openssl": "3.0.8+quic",
"simdutf": "3.2.2",
"tz": "2022g",
"undici": "5.21.0",
"unicode": "15.0",
"uv": "1.44.2",
"uvwasi": "0.0.15",
"v8": "10.2.154.26-node.26",
"zlib": "1.2.13"
},
"toolVersion": "11.0.0"
}

View File

@ -0,0 +1 @@
{"traceEvents":[{"pid":95024,"tid":259,"ts":670166544694,"tts":15313,"ph":"X","cat":"v8","name":"V8.DeserializeIsolate","dur":6926,"tdur":4456,"args":{}},{"pid":95024,"tid":259,"ts":670166553651,"tts":20373,"ph":"X","cat":"v8","name":"V8.DeserializeContext","dur":6055,"tdur":2295,"args":{}},{"pid":95024,"tid":259,"ts":670166584122,"tts":41499,"ph":"B","cat":"devtools.timeline,v8","name":"MinorGC","dur":0,"tdur":0,"args":{"usedHeapSizeBefore":6144472,"type":"allocation failure"}},{"pid":95024,"tid":259,"ts":670166584626,"tts":41990,"ph":"E","cat":"devtools.timeline,v8","name":"MinorGC","dur":0,"tdur":0,"args":{"usedHeapSizeAfter":5557312}},{"pid":95024,"tid":259,"ts":670166594590,"tts":51048,"ph":"B","cat":"devtools.timeline,v8","name":"MinorGC","dur":0,"tdur":0,"args":{"usedHeapSizeBefore":6665288,"type":"allocation failure"}},{"pid":95024,"tid":259,"ts":670166595137,"tts":51579,"ph":"E","cat":"devtools.timeline,v8","name":"MinorGC","dur":0,"tdur":0,"args":{"usedHeapSizeAfter":6188728}},{"pid":95024,"tid":259,"ts":670166544055,"tts":14757,"ph":"M","cat":"__metadata","name":"process_name","dur":0,"tdur":0,"args":{"name":"node"}},{"pid":95024,"tid":259,"ts":670166544061,"tts":14762,"ph":"M","cat":"__metadata","name":"version","dur":0,"tdur":0,"args":{"node":"18.16.0"}},{"pid":95024,"tid":259,"ts":670166544062,"tts":14764,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"JavaScriptMainThread"}},{"pid":95024,"tid":259,"ts":670166544068,"tts":14769,"ph":"M","cat":"__metadata","name":"node","dur":0,"tdur":0,"args":{"process":{"versions":{"node":"18.16.0","v8":"10.2.154.26-node.26","uv":"1.44.2","zlib":"1.2.13","brotli":"1.0.9","ares":"1.19.0","modules":"108","nghttp2":"1.52.0","napi":"8","llhttp":"6.0.10","uvwasi":"0.0.15","acorn":"8.8.2","simdutf":"3.2.2","ada":"1.0.4","undici":"5.21.0","openssl":"3.0.8+quic","cldr":"42.0","icu":"72.1","tz":"2022g","unicode":"15.0","ngtcp2":"0.8.1","nghttp3":"0.7.0"},"arch":"arm64","platform":"darwin","release":{"name":"node","lts":"Hydrogen"}}}},{"pid":95024,"tid":7427,"ts":670166544084,"tts":1,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"WorkerThreadsTaskRunner::DelayedTaskScheduler"}},{"pid":95024,"tid":7687,"ts":670166544123,"tts":8,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":6659,"ts":670166544133,"tts":2,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":7171,"ts":670166544182,"tts":46,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":6403,"ts":670166544202,"tts":14,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":259,"ts":670166544055,"tts":14757,"ph":"M","cat":"__metadata","name":"process_name","dur":0,"tdur":0,"args":{"name":"node"}},{"pid":95024,"tid":259,"ts":670166544061,"tts":14762,"ph":"M","cat":"__metadata","name":"version","dur":0,"tdur":0,"args":{"node":"18.16.0"}},{"pid":95024,"tid":259,"ts":670166544062,"tts":14764,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"JavaScriptMainThread"}},{"pid":95024,"tid":259,"ts":670166544068,"tts":14769,"ph":"M","cat":"__metadata","name":"node","dur":0,"tdur":0,"args":{"process":{"versions":{"node":"18.16.0","v8":"10.2.154.26-node.26","uv":"1.44.2","zlib":"1.2.13","brotli":"1.0.9","ares":"1.19.0","modules":"108","nghttp2":"1.52.0","napi":"8","llhttp":"6.0.10","uvwasi":"0.0.15","acorn":"8.8.2","simdutf":"3.2.2","ada":"1.0.4","undici":"5.21.0","openssl":"3.0.8+quic","cldr":"42.0","icu":"72.1","tz":"2022g","unicode":"15.0","ngtcp2":"0.8.1","nghttp3":"0.7.0"},"arch":"arm64","platform":"darwin","release":{"name":"node","lts":"Hydrogen"}}}},{"pid":95024,"tid":7427,"ts":670166544084,"tts":1,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"WorkerThreadsTaskRunner::DelayedTaskScheduler"}},{"pid":95024,"tid":7687,"ts":670166544123,"tts":8,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":6659,"ts":670166544133,"tts":2,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":7171,"ts":670166544182,"tts":46,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}},{"pid":95024,"tid":6403,"ts":670166544202,"tts":14,"ph":"M","cat":"__metadata","name":"thread_name","dur":0,"tdur":0,"args":{"name":"PlatformWorkerThread"}}]}

View File

@ -5,7 +5,7 @@ const { Message } = require("./Message");
const process = require("process");
const config = process.argv[2] || 'default';
const config = process.argv[2] || "default";
const proxyList = require(`./config/${config}.json`);
for (const channel of proxyList) {
@ -19,14 +19,23 @@ function proxy(config) {
const port = config.port;
const srcHost = config.srcHost;
const srcPort = config.srcPort;
let socket_id_alloc = 0;
const server = net.createServer((socket) => {
console.log("listening " + host + ":" + port);
const socket_id = socket_id_alloc++;
console.log(
"client connected",
host,
port,
socket.remoteAddress,
socket.remotePort,
socket_id
);
const pomelo = new PomeloClient();
const stick = new Stick(1024);
let pomelo = new PomeloClient();
let stick = new Stick(1024);
stick.setMaxBodyLen(MaxBodyLen["32K"], true);
const connectBuffer = [];
let connectBuffer = [];
let isReady = false;
pomelo.init(
@ -41,15 +50,29 @@ function proxy(config) {
repPush(route, body);
}
);
pomelo.on("close", ()=> {
pomelo.on("close", (event) => {
console.log(
host + ":" + port + "=>",
"pomelo on close " + socket_id + " " + event
);
try {
connectBuffer = null;
stick.dispose();
stick = null;
pomelo.destructor();
pomelo = null;
socket.destroy();
} catch(e) {
socket = null;
} catch (e) {
console.log(e);
}
});
pomelo.on("heartbeat timeout", () => {
console.log("pomelo heartbeat timeout");
});
socket.on("connect", () => {
console.log("connect");
});
@ -59,11 +82,25 @@ function proxy(config) {
});
socket.on("close", () => {
console.log("close");
console.log("close " + socket_id + " from client");
try {
pomelo.disconnect();
}
catch(err) {
if (pomelo) {
pomelo.disconnect();
}
connectBuffer = null;
if (stick) {
stick.dispose();
stick = null;
}
if (pomelo) {
pomelo.destructor();
pomelo = null;
}
if (socket) {
socket.destroy();
socket = null;
}
} catch (err) {
console.log(err);
}
});
@ -88,8 +125,8 @@ function proxy(config) {
stick.onBody((msgId, data) => {
try {
const len = data.readUInt16LE(0);
const buf1 = data.subarray(2, 2 + len);
const msg = JSON.parse(buf1);
let buf1 = data.subarray(2, 2 + len);
let msg = JSON.parse(buf1);
console.log(msgId, msg);
const account = "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340";
@ -113,9 +150,9 @@ function proxy(config) {
data.route = route;
try {
console.log("repRequest", data);
socket.write(
stick.makeData(Message.TYPE_RESPONSE, JSON.stringify(data))
);
let dataStr = JSON.stringify(data);
let rdata = stick.makeData(Message.TYPE_RESPONSE, dataStr);
socket.write(rdata);
} catch (e) {
console.log(e);
}
@ -125,7 +162,9 @@ function proxy(config) {
try {
console.log("repPush", data);
data.route = route;
socket.write(stick.makeData(Message.TYPE_PUSH, JSON.stringify(data)));
const dataStr = JSON.stringify(data);
const rdata = stick.makeData(Message.TYPE_PUSH, dataStr);
socket.write(rdata);
} catch (e) {
console.log(e);
}
@ -133,4 +172,5 @@ function proxy(config) {
});
server.listen(port, host);
console.log("listening " + host + ":" + port);
}

View File

@ -1,7 +1,7 @@
const net = require("net");
const { Stick, MaxBodyLen } = require("./lib/stick");
const port = 4999;
const host = "192.168.100.173";
const host = "192.168.100.83";
const { Message } = require("./Message");
const stick = new Stick(1024);
@ -22,7 +22,7 @@ let export_ready = (cb) => {
}
client.connect(port, host, function () {
console.log("Connected");
console.log("client Connected");
let param = {
serial: 123456,
route: "gate.gateHandler.queryEntry",
@ -34,8 +34,8 @@ client.connect(port, host, function () {
});
client.on("data", function (data) {
client.destroy(); // kill client after server's response
stick.putData(data);
client.destroy(); // kill client after server's response
});
client.on("error", function (error) {
@ -53,8 +53,8 @@ stick.onBody((msgId, data) => {
console.log(msgId, msg);
data = JSON.parse(buf1);
setTimeout(() => {
const stick = new Stick(1024);
stick.setMaxBodyLen(MaxBodyLen["32K"], true);
const stickGame = new Stick(1024);
stickGame.setMaxBodyLen(MaxBodyLen["32K"], true);
game = new net.Socket();
let step = 0;
let serialno = 0;
@ -115,10 +115,10 @@ stick.onBody((msgId, data) => {
console.log("Connection closed");
});
game.on("data", function (data) {
stick.putData(data);
stickGame.putData(data);
});
stick.onBody((msgId, data) => {
stickGame.onBody((msgId, data) => {
const len = data.readUInt16LE(0);
const buf1 = data.subarray(2, 2 + len);
const msg = JSON.parse(buf1);
@ -140,7 +140,7 @@ stick.onBody((msgId, data) => {
params: params,
}
game.write(
stick.makeData(Message.TYPE_REQUEST, JSON.stringify(param))
stickGame.makeData(Message.TYPE_REQUEST, JSON.stringify(param))
);
serialcbs[serialno] = cb;
serialno++;

View File

@ -4,8 +4,11 @@ const { Message } = require("./Message");
const port = 4999;
// const host = "192.168.100.173";
const host = "62.234.46.11";
//const host = "r2.cebggame.com";
// const host = "62.234.46.11";
// const host = "r2.cebggame.com";
const host = "192.168.100.83";
//const test_uuid = "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340";
const test_uuid = "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3";
const stick = new Stick(1024);
stick.setMaxBodyLen(MaxBodyLen["32K"], true);
@ -111,8 +114,7 @@ beforeAll(() => {
serial: 123456,
route: "gate.gateHandler.queryEntry",
params: {
uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340",
// uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3",
uid: test_uuid,
},
};
client.write(stick.makeData(Message.TYPE_REQUEST, JSON.stringify(param)));
@ -124,8 +126,7 @@ describe("client", () => {
let msg;
test("entry", async () => {
msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", });
// msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3", });
msg = await rpc("connector.entryHandler.entry", { uid: test_uuid, });
console.log(msg);
expect(msg.code).toBe(200);
});

View File

@ -63,6 +63,7 @@ class PomeloClient extends EventEmitter {
disconnect() {
if (this.socket) {
this.socket.removeAllListeners();
if (this.socket.disconnect) this.socket.disconnect();
if (this.socket.close) this.socket.close();
console.log("disconnect");
@ -348,6 +349,21 @@ class PomeloClient extends EventEmitter {
onKick(data) {
this.emit("onKick");
}
destructor() {
this.data = null;
this.handlers = null;
this.removeAllListeners();
this.disconnect();
if (this.initCallback) {
this.initCallback = null;
}
if (this._push_callback) {
this._push_callback = null;
}
}
}
module.exports = PomeloClient;

View File

@ -4,7 +4,7 @@ const Assert = require('assert');
const StackBuffer = function (bufferSize) {
const bufferLength = bufferSize;
const _event = new EventEmitter();
let _event = new EventEmitter();
let _dataWritePosition = 0;//数据存储起始位置
let _dataReadPosition = 0;//数据存储结束位置
let _dataHeadLen = 2;//数据包头长度
@ -313,6 +313,15 @@ const StackBuffer = function (bufferSize) {
this.getAvailableLen = function () {
return _bufferLength - _dataLen;
};
this.dispose = function () {
_buffer = null;
_dataLen = 0;
_dataWritePosition = 0;
_dataReadPosition = 0;
_bufferLength = 0;
_event = null;
}
};
module.exports = exports = StackBuffer;

252
proxy/package-lock.json generated
View File

@ -8,6 +8,10 @@
"name": "proxy",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"heapdump": "^0.3.15",
"nodemon": "^2.0.22"
},
"devDependencies": {
"jest": "^26.6.3"
}
@ -1016,6 +1020,11 @@
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
"dev": true
},
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"node_modules/acorn": {
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
@ -1114,7 +1123,6 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
"dev": true,
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
@ -1306,8 +1314,7 @@
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/base": {
"version": "0.11.2",
@ -1339,11 +1346,18 @@
"node": ">=0.10.0"
}
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"engines": {
"node": ">=8"
}
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -1353,7 +1367,6 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
@ -1505,6 +1518,32 @@
"node": ">=10"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
@ -1694,8 +1733,7 @@
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/convert-source-map": {
"version": "1.9.0",
@ -2276,7 +2314,6 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
@ -2342,7 +2379,6 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
@ -2429,6 +2465,17 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/globals": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
@ -2535,6 +2582,18 @@
"node": ">=0.10.0"
}
},
"node_modules/heapdump": {
"version": "0.3.15",
"resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.15.tgz",
"integrity": "sha512-n8aSFscI9r3gfhOcAECAtXFaQ1uy4QSke6bnaL+iymYZ/dWs9cqDqHM+rALfsHUwukUbxsdlECZ0pKmJdQ/4OA==",
"hasInstallScript": true,
"dependencies": {
"nan": "^2.13.2"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/hosted-git-info": {
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
@ -2607,6 +2666,11 @@
"node": ">=0.10.0"
}
},
"node_modules/ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA=="
},
"node_modules/import-local": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz",
@ -2669,6 +2733,17 @@
"integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
"dev": true
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
@ -2753,6 +2828,14 @@
"node": ">=0.10.0"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
@ -2771,11 +2854,21 @@
"node": ">=6"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
@ -3771,7 +3864,6 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -3804,8 +3896,12 @@
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
},
"node_modules/nanomatch": {
"version": "1.2.13",
@ -3904,6 +4000,82 @@
"integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==",
"dev": true
},
"node_modules/nodemon": {
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
"integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
"dependencies": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.5"
},
"bin": {
"nodemon": "bin/nodemon.js"
},
"engines": {
"node": ">=8.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/nodemon"
}
},
"node_modules/nodemon/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/nodemon/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"engines": {
"node": ">=4"
}
},
"node_modules/nodemon/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"bin": {
"semver": "bin/semver"
}
},
"node_modules/nodemon/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dependencies": {
"abbrev": "1"
},
"bin": {
"nopt": "bin/nopt.js"
},
"engines": {
"node": "*"
}
},
"node_modules/normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
@ -3929,7 +4101,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
@ -4235,7 +4406,6 @@
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
},
@ -4316,6 +4486,11 @@
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==",
"dev": true
},
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
},
"node_modules/pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
@ -4397,6 +4572,17 @@
"node": ">=8"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
@ -4939,6 +5125,25 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"node_modules/simple-update-notifier": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz",
"integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==",
"dependencies": {
"semver": "~7.0.0"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/simple-update-notifier/node_modules/semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/sisteransi": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
@ -5552,7 +5757,6 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
@ -5560,6 +5764,17 @@
"node": ">=8.0"
}
},
"node_modules/touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dependencies": {
"nopt": "~1.0.10"
},
"bin": {
"nodetouch": "bin/nodetouch.js"
}
},
"node_modules/tough-cookie": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz",
@ -5629,6 +5844,11 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/undefsafe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA=="
},
"node_modules/union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",

View File

@ -5,13 +5,17 @@
"main": "index.js",
"scripts": {
"start": "node app.js",
"proxy": "node app.js proxy"
"proxy": "node app.js proxy",
"dev": "./node_modules/.bin/nodemon app.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"jest": "^26.6.3"
},
"dependencies": {
"heapdump": "^0.3.15",
"nodemon": "^2.0.22"
}
}

View File

@ -5,7 +5,7 @@ const { Message } = require("./Message");
class TestBase {
constructor() {
this.port = 4999;
this.host = "192.168.100.173";
this.host = "192.168.100.83";
this.stick = new Stick(1024);
this.stick.setMaxBodyLen(MaxBodyLen["32K"], true);
@ -72,7 +72,9 @@ class TestBase {
route: route,
params: params,
};
this.game.write(this.stick.makeData(Message.TYPE_REQUEST, JSON.stringify(param)));
this.game.write(
this.stick.makeData(Message.TYPE_REQUEST, JSON.stringify(param))
);
this.serialcbs[this.serialno] = cb;
this.serialno++;
}
@ -126,4 +128,4 @@ class TestBase {
}
}
module.exports = TestBase;
module.exports = TestBase;