cloudflared
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -100,5 +100,8 @@ "use strict"; | ||
}); | ||
process.on("SIGINT", () => { | ||
sub.kill("SIGINT"); | ||
}); | ||
const signals = ["SIGINT", "SIGTERM", "SIGQUIT"]; | ||
for (const signal of signals) { | ||
process.on(signal, () => { | ||
sub.kill(signal); | ||
}); | ||
} | ||
} | ||
@@ -105,0 +108,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -102,28 +102,31 @@ "use strict"; | ||
} | ||
if (!import_node_fs.default.existsSync(import_node_path.default.dirname(to))) { | ||
import_node_fs.default.mkdirSync(import_node_path.default.dirname(to), { recursive: true }); | ||
} | ||
return new Promise((resolve, reject) => { | ||
if (!import_node_fs.default.existsSync(import_node_path.default.dirname(to))) { | ||
import_node_fs.default.mkdirSync(import_node_path.default.dirname(to), { recursive: true }); | ||
} | ||
let done = true; | ||
const file = import_node_fs.default.createWriteStream(to); | ||
const request = import_node_https.default.get(url, (res) => { | ||
if (res.statusCode === 302 && res.headers.location !== void 0) { | ||
const redirect_code = [301, 302, 303, 307, 308]; | ||
if (redirect_code.includes(res.statusCode) && res.headers.location !== void 0) { | ||
request.destroy(); | ||
const redirection = res.headers.location; | ||
done = false; | ||
file.close(() => resolve(download(redirection, to, redirect + 1))); | ||
resolve(download(redirection, to, redirect + 1)); | ||
return; | ||
} | ||
res.pipe(file); | ||
}); | ||
file.on("finish", () => { | ||
if (done) { | ||
file.close(() => resolve(to)); | ||
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { | ||
const file = import_node_fs.default.createWriteStream(to); | ||
file.on("finish", () => { | ||
file.close(() => resolve(to)); | ||
}); | ||
file.on("error", (err) => { | ||
import_node_fs.default.unlink(to, () => reject(err)); | ||
}); | ||
res.pipe(file); | ||
} else { | ||
request.destroy(); | ||
reject(new Error(`HTTP response with status code: ${res.statusCode}`)); | ||
} | ||
}); | ||
request.on("error", (err) => { | ||
import_node_fs.default.unlink(to, () => reject(err)); | ||
reject(err); | ||
}); | ||
file.on("error", (err) => { | ||
import_node_fs.default.unlink(to, () => reject(err)); | ||
}); | ||
request.end(); | ||
@@ -130,0 +133,0 @@ }); |
@@ -32,9 +32,9 @@ "use strict"; | ||
module.exports = __toCommonJS(regex_exports); | ||
const conn_regex = /connection[= ]([a-z0-9-]+)/i; | ||
const conn_regex = /connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i; | ||
const ip_regex = /ip=([0-9.]+)/; | ||
const location_regex = /location=([A-Z]+)/; | ||
const location_regex = /location=([A-Za-z0-9]+)/; | ||
const index_regex = /connIndex=(\d)/; | ||
const disconnect_regex = /Unregistered tunnel connection connIndex=(\d)/i; | ||
const tunnelID_regex = /tunnelID=([0-9a-z-]+)/i; | ||
const connectorID_regex = /Connector ID: ([0-9a-z-]+)/i; | ||
const tunnelID_regex = /tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i; | ||
const connectorID_regex = /Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i; | ||
const metrics_regex = /metrics server on ([0-9.:]+\/metrics)/; | ||
@@ -41,0 +41,0 @@ const config_regex = /config="(.+[^\\])"/; |
{ | ||
"name": "cloudflared", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Cloudflared in Node. Which allows you to easily create HTTPS tunnels using Cloudflare's cloudflared. It provides a typed API for creating tunnels and managing the cloudflared binary installation.", | ||
@@ -24,15 +24,16 @@ "main": "./lib/lib.js", | ||
"devDependencies": { | ||
"@types/jest": "^28.1.6", | ||
"@changesets/changelog-github": "^0.4.8", | ||
"@changesets/cli": "^2.26.2", | ||
"@types/node": "^18.0.6", | ||
"@typescript-eslint/eslint-plugin": "^5.30.7", | ||
"@typescript-eslint/parser": "^5.30.7", | ||
"changeset": "^0.2.6", | ||
"eslint": "^8.20.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"jest": "^28.1.3", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^28.0.7", | ||
"tsup": "^6.1.3", | ||
"typedoc": "^0.23.8", | ||
"typescript": "^4.7.4", | ||
"cloudflared": "0.4.0" | ||
"vitest": "^0.34.4", | ||
"cloudflared": "0.5.0" | ||
}, | ||
@@ -47,4 +48,5 @@ "homepage": "https://github.com/JacobLinCool/node-cloudflared#readme", | ||
}, | ||
"packageManager": "pnpm@8.7.5", | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test": "vitest", | ||
"dev": "tsup --watch", | ||
@@ -55,4 +57,5 @@ "build": "tsup", | ||
"lint": "eslint .", | ||
"postinstall": "node scripts/postinstall.mjs && node lib/cloudflared.js -v" | ||
"postinstall": "node scripts/postinstall.mjs && node lib/cloudflared.js -v", | ||
"changeset": "changeset" | ||
} | ||
} |
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
42738
935
14