zrcadlo
				https://git.coolaj86.com/coolaj86/telebit.js.git
				synchronizováno 2025-11-04 10:42:45 +00:00 
			
		
		
		
	exposed .end method on the wsclient
				
					
				
			Tento commit je obsažen v:
		
							rodič
							
								
									53185c1760
								
							
						
					
					
						revize
						43ea38523b
					
				@ -151,7 +151,7 @@ function connectTunnel() {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
  console.info('');
 | 
					  console.info('');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  stunnel.connect({
 | 
					  var tun = stunnel.connect({
 | 
				
			||||||
    stunneld: program.stunneld
 | 
					    stunneld: program.stunneld
 | 
				
			||||||
  , locals: program.locals
 | 
					  , locals: program.locals
 | 
				
			||||||
  , services: program.services
 | 
					  , services: program.services
 | 
				
			||||||
@ -159,6 +159,17 @@ function connectTunnel() {
 | 
				
			|||||||
  , insecure: program.insecure
 | 
					  , insecure: program.insecure
 | 
				
			||||||
  , token: program.token
 | 
					  , token: program.token
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  function sigHandler() {
 | 
				
			||||||
 | 
					    console.log('SIGINT');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // We want to handle cleanup properly unless something is broken in our cleanup process
 | 
				
			||||||
 | 
					    // that prevents us from exitting, in which case we want the user to be able to send
 | 
				
			||||||
 | 
					    // the signal again and exit the way it normally would.
 | 
				
			||||||
 | 
					    process.removeListener('SIGINT', sigHandler);
 | 
				
			||||||
 | 
					    tun.end();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  process.on('SIGINT', sigHandler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function rawTunnel() {
 | 
					function rawTunnel() {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										37
									
								
								wsclient.js
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								wsclient.js
									
									
									
									
									
								
							@ -272,32 +272,27 @@ function run(copts) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  connect();
 | 
					  connect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function sigHandler() {
 | 
					  return {
 | 
				
			||||||
    console.log('SIGINT');
 | 
					    end: function() {
 | 
				
			||||||
 | 
					      retry = false;
 | 
				
			||||||
 | 
					      if (timeoutId) {
 | 
				
			||||||
 | 
					        clearTimeout(timeoutId);
 | 
				
			||||||
 | 
					        timeoutId = null;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // We want to handle cleanup properly unless something is broken in our cleanup process
 | 
					      if (wstunneler) {
 | 
				
			||||||
    // that prevents us from exitting, in which case we want the user to be able to send
 | 
					        try {
 | 
				
			||||||
    // the signal again and exit the way it normally would.
 | 
					          wstunneler.close();
 | 
				
			||||||
    process.removeListener('SIGINT', sigHandler);
 | 
					        } catch(e) {
 | 
				
			||||||
 | 
					          console.error("[error] wstunneler.close()");
 | 
				
			||||||
    retry = false;
 | 
					          console.error(e);
 | 
				
			||||||
    if (timeoutId) {
 | 
					        }
 | 
				
			||||||
      clearTimeout(timeoutId);
 | 
					 | 
				
			||||||
      timeoutId = null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (wstunneler) {
 | 
					 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        wstunneler.close();
 | 
					 | 
				
			||||||
      } catch(e) {
 | 
					 | 
				
			||||||
        console.error("[error] wstunneler.close()");
 | 
					 | 
				
			||||||
        console.error(e);
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
  process.on('SIGINT', sigHandler);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports.connect = run;
 | 
					module.exports.connect = run;
 | 
				
			||||||
 | 
					module.exports.createConnection = run;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}());
 | 
					}());
 | 
				
			||||||
 | 
				
			|||||||
		Načítá se…
	
	
			
			x
			
			
		
	
		Odkázat v novém úkolu
	
	Zablokovat Uživatele