v0.20.2: cleanup welcome page
This commit is contained in:
parent
42d558b85e
commit
31e036e341
|
@ -924,7 +924,9 @@ function rawStartTelebitRemote(keepAlive) {
|
|||
function onConnect() {
|
||||
console.info('[connect] relay established');
|
||||
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) {
|
||||
reject(err);
|
||||
return;
|
||||
|
@ -937,20 +939,16 @@ function rawStartTelebitRemote(keepAlive) {
|
|||
|
||||
function onConnectError(err) {
|
||||
myRemote = null;
|
||||
// Likely causes:
|
||||
// * DNS lookup failed (no Internet)
|
||||
// * Rejected (bad authn)
|
||||
if ('ENOTFOUND' === err.code) {
|
||||
// DNS issue, probably network is disconnected
|
||||
if (handleError(err, 'onConnectError')) {
|
||||
if (!keepAlive.state) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
console.warn('[Warn] onConnectError: network error, will retry', err);
|
||||
safeReload(10 * 1000).then(resolve).catch(reject);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -988,32 +986,68 @@ function rawStartTelebitRemote(keepAlive) {
|
|||
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
|
||||
function retryWssLoop(err) {
|
||||
if (!keepAlive.state) {
|
||||
console.log("[debug] error getting wss url:");
|
||||
console.log(err);
|
||||
return PromiseA.reject(err);
|
||||
}
|
||||
|
||||
myRemote = null;
|
||||
if (!err) {
|
||||
return startHelper();
|
||||
}
|
||||
|
||||
if ('ENOTFOUND' === err.code) {
|
||||
// The internet is disconnected
|
||||
// try again, and again, and again
|
||||
if (handleError(err, 'retryWssLoop')) {
|
||||
// Always retry at this stage. It *is* a connectivity problem.
|
||||
// Since the internet is disconnected, try again and again and again.
|
||||
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) {
|
||||
state.wss = wss;
|
||||
console.log("[debug] got wss url");
|
||||
keepAlive.error = null;
|
||||
return startHelper();
|
||||
}).catch(function (err) {
|
||||
return retryWssLoop(err);
|
||||
});
|
||||
}).catch(retryWssLoop);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,22 @@
|
|||
<h2>You've claimed <span class="js-servername">{{servername}}</span></h2>
|
||||
<p>Here's some ways you can use it:</p>
|
||||
<div class="code-block">
|
||||
<pre><code>telebit http 3000 # forward all https traffic to localhost:3000
|
||||
telebit http /path/to/module # handle incoming https traffic with a node module
|
||||
<pre><code>telebit http ~/Public # serve a public folder
|
||||
telebit http 3000 # forward all https traffic to localhost:3000
|
||||
telebit http none # remove all https handlers</code></pre>
|
||||
</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>
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"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.",
|
||||
"main": "lib/remote.js",
|
||||
"files": [
|
||||
|
|
Loading…
Reference in New Issue