diff --git a/.gitignore b/.gitignore index 227235e..1b7deb2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ cache +cert config.json out.* node_modules diff --git a/.gitmodules b/.gitmodules index b7ee6a9..2aa7398 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "native/src/wmi"] path = native/src/wmi - url = https://github.com/Thomas-Sparber/wmi.git + url = https://github.com/HolographicHat/wmi diff --git a/cert/root.p12 b/cert/root.p12 deleted file mode 100644 index e53963d..0000000 Binary files a/cert/root.p12 and /dev/null differ diff --git a/native/.gitignore b/native/.gitignore index 2fd6324..07e4818 100644 --- a/native/.gitignore +++ b/native/.gitignore @@ -3,4 +3,3 @@ CMakeLists.txt cmake-build-debug node_modules build -src/wmi diff --git a/native/src/wmi b/native/src/wmi new file mode 160000 index 0000000..aab36ea --- /dev/null +++ b/native/src/wmi @@ -0,0 +1 @@ +Subproject commit aab36ea1e1700f3d33f9dfc9f8df950c30e2c6ec diff --git a/regionServer.js b/regionServer.js index af101ed..62f1770 100644 --- a/regionServer.js +++ b/regionServer.js @@ -16,8 +16,15 @@ const getModifiedRegionList = async (conf) => { channel_id: conf.channel, sub_channel_id: conf.subChannel } + }).catch(_ => { + console.log("网络错误,请检查网络后重试 (22-1)") + process.exit(221) }) const regions = await decodeProto(Buffer.from(d.data,"base64"),"QueryRegionList") + if (regions["retcode"] !== 0) { + console.log(`系统错误,请稍后重试 (${regions["retcode"]}-23)`) + process.exit(23) + } regions.list = regions.list.map(item => { const host = new URL(item.url).host if (regions.list.length === 1) { @@ -36,12 +43,19 @@ const getModifiedRegionInfo = async (url, uc, hs) => { const query = noQueryRequest ? "" : `?${splitUrl[1]}` const d = await axios.get(`https://${host}/query_cur_region${query}`, { responseType: "text" + }).catch(_ => { + console.log("网络错误,请检查网络后重试 (22-2)") + process.exit(222) }) if (noQueryRequest) { preparedRegions[host] = true return d.data } else { const region = await decodeProto(Buffer.from(d.data,"base64"),"QueryCurRegion") + if (region["retcode"] !== 0) { + console.log(`${region["message"]} (${region["retcode"]}-24)`) + process.exit(24) + } const info = region.info if (preparedRegions[host]) { if (currentProxy !== undefined) { @@ -69,7 +83,7 @@ const create = async (conf, regionListLoadedCallback, regionSelectCallback) => { passphrase: "" }, async (request, response) => { const url = request.url - debug("HTTP请求: %s", url) + debug("HTTP: %s", url) response.writeHead(200, { "Content-Type": "text/html" }) if (url.startsWith("/query_region_list")) { response.end(regions) @@ -80,17 +94,14 @@ const create = async (conf, regionListLoadedCallback, regionSelectCallback) => { const frontResponse = await axios.get(`https://${conf.dispatchIP}${url}`, { responseType: "arraybuffer", httpsAgent: agent + }).catch(err => { + console.log("网络错误,请检查网络后重试 (22-3)") + console.log(err.message) + process.exit(223) }) response.end(frontResponse.data) } - }) - hServer.on("error", err => { - if (err["code"] === "EADDRINUSE") { - console.log("本机 443 端口被其它程序占用,请关闭后重试") - } - throw err - }) - hServer.listen(443, "127.0.0.1", () => { + }).listen(443, "127.0.0.1", () => { regionListLoadedCallback() }) }