Skip to content

Commit a3226bc

Browse files
authored
Enhance filter links and tunnel management
Added new filter links and improved tunnel spawning logic.
1 parent f8233fb commit a3226bc

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

server-src/pinggy.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { spawn } = require("node:child_process");
22

33
// Configuration
44
let serverPort = process.env.PORT || process.env.serverPort || 3000;
5-
const filterLinks = ["https://dashboard.pinggy.io", "https://pinggy.io"];
5+
const filterLinks = ["https://dashboard.pinggy.io", "https://pinggy.io", "https://admin.localhost.run", "https://twitter.com", ""];
66
const maxPinggy = 25; // Total concurrent tunnels
77

88
const commandArgs = [
@@ -22,6 +22,16 @@ const commandArgs = [
2222
"qr@free.pinggy.io",
2323
],
2424
],
25+
[
26+
"ssh",
27+
[
28+
"-o",
29+
"StrictHostKeyChecking=no",
30+
"-R",
31+
`80:localhost:${serverPort}`,
32+
"nokey@localhost.run"
33+
]
34+
]
2535
];
2636

2737
var activeTunnels = new Map();
@@ -35,6 +45,12 @@ function spawnTunnel(index) {
3545
const child = spawn(cmdName, args);
3646
const pid = child.pid;
3747

48+
var yesInterval = setInterval(() => {
49+
try{
50+
child.stdin.write("yes\n");
51+
}catch(e){}
52+
},1000);
53+
3854
child.stdout.on("data", (data) => {
3955
const output = data.toString();
4056

@@ -70,6 +86,8 @@ function spawnTunnel(index) {
7086
curPinggy -= 1;
7187
activeTunnels.delete(pid);
7288

89+
clearInterval(yesInterval);
90+
7391
// Staggered restart to avoid spamming the CPU
7492
setTimeout(() => {
7593
spawnTunnel(index);

0 commit comments

Comments
 (0)