update docs

This commit is contained in:
AJ ONeal 2018-09-12 03:33:38 -06:00
parent ed34adb1a7
commit 3726798062
4 changed files with 119 additions and 65 deletions

View File

@ -12,6 +12,7 @@ var http = require('http');
//var https = require('https');
var YAML = require('js-yaml');
var TOML = require('toml');
var TPLS = TOML.parse(fs.readFileSync(path.join(__dirname, "../lib/en-us.toml"), 'utf8'));
/*
if ('function' !== typeof TOML.stringify) {
TOML.stringify = require('json2toml');
@ -45,48 +46,7 @@ if (-1 !== argIndex) {
}
function help() {
console.info('');
console.info('Telebit is a tool for helping you access your devices and share your stuff.');
console.info('');
console.info('Usage:');
console.info('');
console.info('\ttelebit [flags] <command> <arguments>');
console.info('');
console.info('The flags are:');
console.info('');
console.info('\t--config <path> specify a config file (default is ~/.config/telebit/telebit.yml)');
console.info('');
console.info('Examples:');
console.info('');
//console.info('\tinit bootstrap the config files');
//console.info('');
console.info('\tstatus whether enabled or disabled');
console.info('\tenable disallow incoming connections');
console.info('\tdisable allow incoming connections');
console.info('');
console.info('\tlist list rules for servernames and ports');
console.info('');
console.info('\thttp <path> [domain] serve a file, folder, or node express app');
console.info('\thttp <port> forward all https traffic to port 3000');
console.info('\thttp none remove all https handlers');
console.info('');
console.info('\thttp none example.com remove https handler from example.com');
console.info('\thttp 3001 sub.example.com forward https traffic for sub.example.com to port 3001');
console.info('\thttp /module/path sub forward https traffic for sub.example.com to port 3001');
console.info('');
console.info('\ttcp none remove all tcp handlers');
console.info('\ttcp 5050 forward all tcp to port 5050');
console.info('\ttcp /module/path handle all tcp with a node module');
console.info('');
console.info('\ttcp none 6565 remove tcp handler from external port 6565');
console.info('\ttcp 5050 6565 forward external port 6565 to local 5050');
console.info('\ttcp /module/path 6565 handle external port 6565 with a node module');
console.info('');
console.info('Config:');
console.info('');
console.info('\tSee https://git.coolaj86.com/coolaj86/telebit.js');
console.info('');
console.info('');
console.info(TPLS.remote.help.main.replace(/{version}/g, pkg.version));
}
var verstr = [ pkg.name + ' remote v' + pkg.version ];

View File

@ -2,18 +2,35 @@
(function () {
'use strict';
//
// node telebit daemon arg1 arg2
//
if ('daemon' === process.argv[2]) {
require('./telebitd.js');
} else if ('sclient' === process.argv[2]) {
process.argv.splice(1,1);
require('sclient/bin/sclient.js');
} else if ('ssh' === process.argv[2] && /[\w-]+\.[a-z]{2,}/i.test(process.argv[3])) {
process.argv.splice(1,1,'sclient');
process.argv.splice(2,1,'--ssh');
require('sclient/bin/sclient.js');
} else {
require('./telebit-remote.js');
return;
}
//
// sclient proxies
//
if ('sclient' === process.argv[2]) {
process.argv.splice(1,1);
return;
}
if ('rsync' === process.argv[2]) {
require('sclient/bin/sclient.js');
return;
}
if ('ssh' === process.argv[2] && /[\w-]+\.[a-z]{2,}/i.test(process.argv[3])) {
process.argv.splice(1,1,'sclient');
process.argv.splice(2,1,'ssh');
require('sclient/bin/sclient.js');
return;
}
//
// telebit remote
//
require('./telebit-remote.js');
}());

View File

@ -17,10 +17,13 @@ var os = require('os');
var fs = require('fs');
var common = require('../lib/cli-common.js');
var http = require('http');
var TOML = require('toml');
var YAML = require('js-yaml');
var recase = require('recase').create({});
var camelCopy = recase.camelCopy.bind(recase);
var snakeCopy = recase.snakeCopy.bind(recase);
var TPLS = TOML.parse(fs.readFileSync(path.join(__dirname, "../lib/en-us.toml"), 'utf8'));
var TelebitRemote = require('../').TelebitRemote;
var state = { homedir: os.homedir(), servernames: {}, ports: {}, keepAlive: { state: false } };
@ -41,20 +44,7 @@ if (-1 !== confIndex) {
var cancelUpdater = require('../lib/updater')(pkg);
function help() {
console.info('');
console.info('Telebit Daemon v' + pkg.version);
console.info('');
console.info('Usage:');
console.info('');
console.info('\ttelebitd --config <path>');
console.info('\tex: telebitd --config ~/.config/telebit/telebitd.yml');
console.info('');
console.info('');
console.info('Config:');
console.info('');
console.info('\tSee https://git.coolaj86.com/coolaj86/telebit.js');
console.info('');
console.info('');
console.info(TPLS.daemon.help.main.replace(/{version}/g, pkg.version));
}
var verstr = [ pkg.name + ' daemon v' + pkg.version ];

87
lib/en-us.toml Normal file
View File

@ -0,0 +1,87 @@
[remote]
[remote.help]
main = "telebit remote v{version}
Telebit is a tool for helping you access your devices and share your stuff.
Usage:
telebit [flags] <command> [arguments]
The flags are:
--config <path> specify config file (default is ~/.config/telebit/telebit.yml)
The commands are:
status show status and configuration info
enable turn on remote access and sharing
disable turn off remote access and sharing
http access files, folders, and local apps via https (secure)
ssh (local) enable remote access to this device with ssh-over-https
ssh (remote) access devices via ssh-over-https (telebit, stunnel, openssl, etc)
tcp forward tcp locally
Use \"telebit help [command]\" for more information about a command.
Additional help topics:
config config file format and settings
ssh (proxy) ssh over https and proxy commands
ftp secure ftp file transfer between devices
rsync rsync over https and proxy commands
vpn home network access and private web browsing via socks5
daemon telebit daemon secure background service
relay telebit secure relay, hosted, and self-hosting options
Copyright 2015-2018 https://telebit.cloud MPL-2.0 Licensed"
http = "usage: telebit http <path/port/none> [subdomain]
'telebit http' is the fastest way to share files, folders, and local apps.
http <DIR> [subdomain] serve a file, folder, or node express app
ex: telebit http ~/Public pub securely host ~/Public as pub.johndoe.telebit.io
http <PORT> [subdomain] forward all https traffic to a local app
ex: telebit http 3000 app publicize localhost:3000 as app.johndoe.telebit.io
http none [subdomain] remove secure http access for (any or all) subdomain(s)
ex: telebit http none remove all https access
"
tcp = "
usage: telebit tcp <path/port/none>
'telebit tcp' is provided for seemless connectivity to legacy apps
tcp <local> [remote] forward tcp to <local> from <remote>
ex: telebit tcp 5050 6565 forward tcp port 6565 locally to port 5050
tcp <path> [remote] show ftp-style directory listing
ex: telebit tcp ~/Public show listing of ~/Public
tcp none [remote] disable tcp access for [remote] port
ex: telebit tcp none 6565 remove access to port 6565
See also sclient <https://telebit.cloud/sclient> for connecting to legacy apps
with telebit-upscaled secure https access.
"
[daemon]
[daemon.help]
main = "telebit daemon v{version}
Usage:
telebit daemon --config <path>
ex: telebit daemon --config ~/.config/telebit/telebitd.yml
Additional help topics:
config config file format and settings
remote telebit cli remote control
Copyright 2015-2018 https://telebit.cloud MPL-2.0 Licensed"