v0.20.2: cleanup welcome page
This commit is contained in:
parent
42d558b85e
commit
31e036e341
|
@ -924,7 +924,9 @@ function rawStartTelebitRemote(keepAlive) {
|
||||||
function onConnect() {
|
function onConnect() {
|
||||||
console.info('[connect] relay established');
|
console.info('[connect] relay established');
|
||||||
myRemote.removeListener('error', onConnectError);
|
myRemote.removeListener('error', onConnectError);
|
||||||
myRemote.once('error', function () {
|
myRemote.once('error', function (err) {
|
||||||
|
console.log("[debug] Error after connect.");
|
||||||
|
console.log(err);
|
||||||
if (!keepAlive.state) {
|
if (!keepAlive.state) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
|
@ -937,20 +939,16 @@ function rawStartTelebitRemote(keepAlive) {
|
||||||
|
|
||||||
function onConnectError(err) {
|
function onConnectError(err) {
|
||||||
myRemote = null;
|
myRemote = null;
|
||||||
// Likely causes:
|
if (handleError(err, 'onConnectError')) {
|
||||||
// * DNS lookup failed (no Internet)
|
|
||||||
// * Rejected (bad authn)
|
|
||||||
if ('ENOTFOUND' === err.code) {
|
|
||||||
// DNS issue, probably network is disconnected
|
|
||||||
if (!keepAlive.state) {
|
if (!keepAlive.state) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.warn('[Warn] onConnectError: network error, will retry', err);
|
|
||||||
safeReload(10 * 1000).then(resolve).catch(reject);
|
safeReload(10 * 1000).then(resolve).catch(reject);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error('[Error] onConnectError: no retry (possibly bad auth)', err);
|
console.error('[Error] onConnectError: no retry (possibly bad auth):');
|
||||||
|
console.error(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -988,32 +986,68 @@ function rawStartTelebitRemote(keepAlive) {
|
||||||
return startHelper();
|
return startHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleError(err, prefix) {
|
||||||
|
// Likely causes:
|
||||||
|
// * DNS lookup failed (no Internet)
|
||||||
|
// * Rejected (bad authn)
|
||||||
|
if ('ENOTFOUND' === err.code) {
|
||||||
|
// DNS issue, probably network is disconnected
|
||||||
|
err.message = [
|
||||||
|
'[warn] (' + prefix + '): DNS address not found.'
|
||||||
|
, ' Either the remote does not exist or local network is down or blocked.'
|
||||||
|
, ' You might check wifi, eth, paywall, etc.'
|
||||||
|
].join('\n');
|
||||||
|
if (keepAlive.error !== err.code) {
|
||||||
|
console.warn(err.message);
|
||||||
|
keepAlive.error = err.code;
|
||||||
|
console.warn("(retrying silently)");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else if ('ECONNREFUSED' === err.code) {
|
||||||
|
// Server issue. If it's the development server, it's probably down
|
||||||
|
err.message = [
|
||||||
|
'[warn] onConnectError: Connection Refused.'
|
||||||
|
, ' Either the remote does not exist or local network is blocking it.'
|
||||||
|
, ' Is the relay service provider\'s website up? Did you make a typo?'
|
||||||
|
, ' Is there a local firewall or paywall? Might the relay be otherwise blocked?'
|
||||||
|
].join('\n');
|
||||||
|
if (keepAlive.error !== err.code) {
|
||||||
|
console.warn(err.message);
|
||||||
|
keepAlive.error = err.code;
|
||||||
|
console.warn("(retrying silently)");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get the wss url
|
// get the wss url
|
||||||
function retryWssLoop(err) {
|
function retryWssLoop(err) {
|
||||||
if (!keepAlive.state) {
|
if (!keepAlive.state) {
|
||||||
|
console.log("[debug] error getting wss url:");
|
||||||
|
console.log(err);
|
||||||
return PromiseA.reject(err);
|
return PromiseA.reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
myRemote = null;
|
myRemote = null;
|
||||||
if (!err) {
|
if (handleError(err, 'retryWssLoop')) {
|
||||||
return startHelper();
|
// Always retry at this stage. It *is* a connectivity problem.
|
||||||
}
|
// Since the internet is disconnected, try again and again and again.
|
||||||
|
|
||||||
if ('ENOTFOUND' === err.code) {
|
|
||||||
// The internet is disconnected
|
|
||||||
// try again, and again, and again
|
|
||||||
return safeReload(2 * 1000);
|
return safeReload(2 * 1000);
|
||||||
|
} else {
|
||||||
|
console.error("[error] retryWssLoop (will not retry):");
|
||||||
|
console.error(err.message);
|
||||||
|
return PromiseA.reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PromiseA.reject(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It makes since for this to be in here because the server
|
||||||
|
// could be restarting to force a change of the metadata
|
||||||
return promiseWss(state).then(function (wss) {
|
return promiseWss(state).then(function (wss) {
|
||||||
state.wss = wss;
|
state.wss = wss;
|
||||||
|
console.log("[debug] got wss url");
|
||||||
|
keepAlive.error = null;
|
||||||
return startHelper();
|
return startHelper();
|
||||||
}).catch(function (err) {
|
}).catch(retryWssLoop);
|
||||||
return retryWssLoop(err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,22 @@
|
||||||
<h2>You've claimed <span class="js-servername">{{servername}}</span></h2>
|
<h2>You've claimed <span class="js-servername">{{servername}}</span></h2>
|
||||||
<p>Here's some ways you can use it:</p>
|
<p>Here's some ways you can use it:</p>
|
||||||
<div class="code-block">
|
<div class="code-block">
|
||||||
<pre><code>telebit http 3000 # forward all https traffic to localhost:3000
|
<pre><code>telebit http ~/Public # serve a public folder
|
||||||
telebit http /path/to/module # handle incoming https traffic with a node module
|
telebit http 3000 # forward all https traffic to localhost:3000
|
||||||
telebit http none # remove all https handlers</code></pre>
|
telebit http none # remove all https handlers</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>You can <em>always</em> use this port for <strong>SSH over HTTPS</strong>, even while you're using it for something else:</p>
|
<p>You can <em>always</em> tunnel <strong>SSH over HTTPS</strong>,
|
||||||
|
even while you're using it for something else:</p>
|
||||||
|
<div class="code-block"><pre><code>telebit ssh auto</code></pre>
|
||||||
|
<br>
|
||||||
|
<pre><code>telebit ssh <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
|
- or -
|
||||||
|
<pre><code>ssh -o ProxyCommand='<a href="https://telebit.cloud/sclient">sclient</a> %h' <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
|
- or -
|
||||||
|
<pre><code>proxy_cmd='openssl s_client -connect %h:443 -servername %h -quiet'
|
||||||
|
ssh -o ProxyCommand="$proxy_cmd" <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
|
</div>
|
||||||
<pre><code>ssh -o ProxyCommand='openssl s_client -connect %h:443 -servername %h -quiet' <span class="js-servername">{{servername}}</span></code></pre>
|
<pre><code>ssh -o ProxyCommand='openssl s_client -connect %h:443 -servername %h -quiet' <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "telebit",
|
"name": "telebit",
|
||||||
"version": "0.20.1-wip",
|
"version": "0.20.2-wip",
|
||||||
"description": "Break out of localhost. Connect to any device from anywhere over any tcp port or securely in a browser. A secure tunnel. A poor man's reverse VPN.",
|
"description": "Break out of localhost. Connect to any device from anywhere over any tcp port or securely in a browser. A secure tunnel. A poor man's reverse VPN.",
|
||||||
"main": "lib/remote.js",
|
"main": "lib/remote.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
Loading…
Reference in New Issue