2018-09-04 05:02:11 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
2018-09-12 09:33:38 +00:00
|
|
|
//
|
2018-09-04 05:02:11 +00:00
|
|
|
// node telebit daemon arg1 arg2
|
2018-09-12 09:33:38 +00:00
|
|
|
//
|
2018-09-05 19:33:01 +00:00
|
|
|
if ('daemon' === process.argv[2]) {
|
2018-09-04 05:02:11 +00:00
|
|
|
require('./telebitd.js');
|
2018-09-12 09:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// sclient proxies
|
|
|
|
//
|
|
|
|
if ('sclient' === process.argv[2]) {
|
2018-09-11 08:02:15 +00:00
|
|
|
process.argv.splice(1,1);
|
2018-09-12 09:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ('rsync' === process.argv[2]) {
|
2018-09-11 08:02:15 +00:00
|
|
|
require('sclient/bin/sclient.js');
|
2018-09-12 09:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ('ssh' === process.argv[2] && /[\w-]+\.[a-z]{2,}/i.test(process.argv[3])) {
|
2018-09-11 08:02:15 +00:00
|
|
|
process.argv.splice(1,1,'sclient');
|
2018-09-12 09:33:38 +00:00
|
|
|
process.argv.splice(2,1,'ssh');
|
2018-09-11 08:02:15 +00:00
|
|
|
require('sclient/bin/sclient.js');
|
2018-09-12 09:33:38 +00:00
|
|
|
return;
|
2018-09-04 05:02:11 +00:00
|
|
|
}
|
|
|
|
|
2018-09-12 09:33:38 +00:00
|
|
|
//
|
|
|
|
// telebit remote
|
|
|
|
//
|
|
|
|
require('./telebit-remote.js');
|
|
|
|
|
2018-09-04 05:02:11 +00:00
|
|
|
}());
|