devtunnel-cli 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/bin/README.md +40 -0
- package/package.json +56 -0
- package/src/core/RUN.js +41 -0
- package/src/core/index.js +394 -0
- package/src/core/proxy-server.js +72 -0
- package/src/core/setup-cloudflared.js +334 -0
- package/src/core/start.js +200 -0
- package/src/utils/folder-picker.js +140 -0
- package/src/utils/tunnel-helpers.js +35 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Helper functions for different tunnel services
|
|
2
|
+
|
|
3
|
+
export async function startLocalTunnel(port) {
|
|
4
|
+
try {
|
|
5
|
+
const localtunnel = await import("localtunnel");
|
|
6
|
+
const tunnel = await localtunnel.default({ port });
|
|
7
|
+
|
|
8
|
+
console.log("\n" + "=".repeat(50));
|
|
9
|
+
console.log("ā
PUBLIC URL:");
|
|
10
|
+
console.log(` ${tunnel.url}`);
|
|
11
|
+
console.log("=".repeat(50) + "\n");
|
|
12
|
+
|
|
13
|
+
tunnel.on("close", () => {
|
|
14
|
+
console.log("\nš Tunnel closed");
|
|
15
|
+
process.exit(0);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Keep the process running
|
|
19
|
+
process.on("SIGINT", () => {
|
|
20
|
+
tunnel.close();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error("ā LocalTunnel error:", error.message);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// If called directly from command line
|
|
30
|
+
if (process.argv[2] === "localtunnel") {
|
|
31
|
+
const port = parseInt(process.argv[3]);
|
|
32
|
+
if (port) {
|
|
33
|
+
startLocalTunnel(port);
|
|
34
|
+
}
|
|
35
|
+
}
|