-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.ts
43 lines (39 loc) · 1.59 KB
/
command.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
/*
* This file is part of the noncloud.
* Copyright (c) 2018 TANIGUCHI Masaya.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Commander = require("commander");
import { readFileSync } from "fs";
import client from "./client";
import server from "./server";
const buffer = readFileSync(`${__dirname}/../package.json`);
const version = JSON.parse(buffer.toString()).version;
Commander.command("server")
.option("-a, --authorization <username:password>", "set hyper-tunnel account")
.option("-e, --encryption", "use encryption")
.option("-p, --port <port>", "listen this port")
.action(server);
Commander.command("client")
.option("-a, --authorization <username:password>", "login noncloud server")
.option("-r, --remotehost <remotehost:port>", "set noncloud server")
.option("-l, --localhost <localhost:port>", "tunnel traffic to this host")
.option(
"-p, --protocol <remotehost:websocket:localhost>",
"use this protocols",
"https:wss:http"
)
.action(client);
Commander.version(version, "-v, --version").parse(process.argv);