mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-08 05:10:05 +03:00
remove obsolete usage string and added lost version option
This commit is contained in:
parent
fa848f2ae9
commit
4a6bbda60d
1
common.h
1
common.h
@ -171,7 +171,6 @@ int flush_deferred(struct queue *q);
|
||||
|
||||
extern struct sslhcfg_item cfg;
|
||||
extern struct addrinfo *addr_listen;
|
||||
extern const char* USAGE_STRING;
|
||||
extern const char* server_type;
|
||||
|
||||
/* sslh-fork.c */
|
||||
|
47
sslh-conf.c
47
sslh-conf.c
@ -1,5 +1,5 @@
|
||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||
* on Fri Aug 13 18:03:18 2021.
|
||||
* on Tue Aug 24 13:53:04 2021.
|
||||
|
||||
# conf2struct: generate libconf parsers that read to structs
|
||||
# Copyright (C) 2018-2021 Yves Rutschle
|
||||
@ -444,6 +444,7 @@ struct compound_cl_arg {
|
||||
|
||||
struct arg_file* sslhcfg_conffile;
|
||||
struct arg_int* sslhcfg_verbose;
|
||||
struct arg_lit* sslhcfg_version;
|
||||
struct arg_lit* sslhcfg_foreground;
|
||||
struct arg_lit* sslhcfg_inetd;
|
||||
struct arg_lit* sslhcfg_numeric;
|
||||
@ -782,7 +783,7 @@ static struct config_desc table_sslhcfg_listen[] = {
|
||||
},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
||||
static struct config_desc table_sslhcfg[] = {
|
||||
|
||||
|
||||
@ -802,6 +803,22 @@ static struct config_desc table_sslhcfg[] = {
|
||||
/* default_val*/ .default_val.def_int = 0
|
||||
},
|
||||
|
||||
{
|
||||
/* name */ "version",
|
||||
/* type */ CFG_BOOL,
|
||||
/* sub_group*/ NULL,
|
||||
/* arg_cl */ & sslhcfg_version,
|
||||
/* base_addr */ NULL,
|
||||
/* offset */ offsetof(struct sslhcfg_item, version),
|
||||
/* offset_len */ 0,
|
||||
/* offset_present */ 0,
|
||||
/* size */ sizeof(int),
|
||||
/* array_type */ -1,
|
||||
/* mandatory */ 0,
|
||||
/* optional */ 0,
|
||||
/* default_val*/ .default_val.def_bool = 0
|
||||
},
|
||||
|
||||
{
|
||||
/* name */ "foreground",
|
||||
/* type */ CFG_BOOL,
|
||||
@ -1106,7 +1123,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: listen */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_listen,
|
||||
.base_entry = & table_sslhcfg [12],
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.targets = sslhcfg_listen_targets,
|
||||
|
||||
|
||||
@ -1118,7 +1135,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: ssh */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_ssh,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_ssh_targets,
|
||||
|
||||
|
||||
@ -1130,7 +1147,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: tls */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_tls,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_tls_targets,
|
||||
|
||||
|
||||
@ -1142,7 +1159,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: openvpn */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_openvpn,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_openvpn_targets,
|
||||
|
||||
|
||||
@ -1154,7 +1171,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: tinc */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_tinc,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_tinc_targets,
|
||||
|
||||
|
||||
@ -1166,7 +1183,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: xmpp */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_xmpp,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_xmpp_targets,
|
||||
|
||||
|
||||
@ -1178,7 +1195,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: http */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_http,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_http_targets,
|
||||
|
||||
|
||||
@ -1190,7 +1207,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: adb */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_adb,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_adb_targets,
|
||||
|
||||
|
||||
@ -1202,7 +1219,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: socks5 */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_socks5,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_socks5_targets,
|
||||
|
||||
|
||||
@ -1214,7 +1231,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: syslog */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_syslog,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_syslog_targets,
|
||||
|
||||
|
||||
@ -1226,7 +1243,7 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
{ /* arg: anyprot */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_anyprot,
|
||||
.base_entry = & table_sslhcfg [13],
|
||||
.base_entry = & table_sslhcfg [14],
|
||||
.targets = sslhcfg_anyprot_targets,
|
||||
|
||||
|
||||
@ -1892,6 +1909,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
|
||||
sslhcfg_conffile = arg_filen("F", "config", "<file>", 0, 1, "Specify configuration file"),
|
||||
#endif
|
||||
sslhcfg_verbose = arg_intn("v", "verbose", "<n>", 0, 1, ""),
|
||||
sslhcfg_version = arg_litn("V", "version", 0, 1, "Print version information and exit"),
|
||||
sslhcfg_foreground = arg_litn("f", "foreground", 0, 1, "Run in foreground instead of as a daemon"),
|
||||
sslhcfg_inetd = arg_litn("i", "inetd", 0, 1, "Run in inetd mode: use stdin/stdout instead of network listen"),
|
||||
sslhcfg_numeric = arg_litn("n", "numeric", 0, 1, "Print IP addresses and ports as numbers"),
|
||||
@ -2062,6 +2080,9 @@ void sslhcfg_fprint(
|
||||
fprintf(out, "verbose: %d", sslhcfg->verbose);
|
||||
fprintf(out, "\n");
|
||||
indent(out, depth);
|
||||
fprintf(out, "version: %d", sslhcfg->version);
|
||||
fprintf(out, "\n");
|
||||
indent(out, depth);
|
||||
fprintf(out, "foreground: %d", sslhcfg->foreground);
|
||||
fprintf(out, "\n");
|
||||
indent(out, depth);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||
* on Fri Aug 13 18:03:18 2021.
|
||||
* on Tue Aug 24 13:53:04 2021.
|
||||
|
||||
# conf2struct: generate libconf parsers that read to structs
|
||||
# Copyright (C) 2018-2021 Yves Rutschle
|
||||
@ -75,6 +75,7 @@ struct sslhcfg_protocols_item {
|
||||
|
||||
struct sslhcfg_item {
|
||||
int verbose;
|
||||
int version;
|
||||
int foreground;
|
||||
int inetd;
|
||||
int numeric;
|
||||
|
29
sslh-main.c
29
sslh-main.c
@ -37,29 +37,6 @@
|
||||
#include "common.h"
|
||||
#include "probe.h"
|
||||
|
||||
const char* USAGE_STRING =
|
||||
"sslh " VERSION "\n" \
|
||||
"usage:\n" \
|
||||
"\tsslh [-v] [-i] [-V] [-f] [-n] [--transparent] [-F<file>]\n"
|
||||
"\t[-t <timeout>] [-P <pidfile>] [-u <username>] [-C <chroot>] -p <addr> [-p <addr> ...] \n" \
|
||||
"%s\n\n" /* Dynamically built list of builtin protocols */ \
|
||||
"\t[--on-timeout <addr>]\n" \
|
||||
"-v: verbose\n" \
|
||||
"-V: version\n" \
|
||||
"-f: foreground\n" \
|
||||
"-n: numeric output\n" \
|
||||
"-u: specify under which user to run\n" \
|
||||
"-C: specify under which chroot path to run\n" \
|
||||
"--transparent: behave as a transparent proxy\n" \
|
||||
"-F: use configuration file (warning: no space between -F and file name!)\n" \
|
||||
"--on-timeout: connect to specified address upon timeout (default: ssh address)\n" \
|
||||
"-t: seconds to wait before connecting to --on-timeout address.\n" \
|
||||
"-p: address and port to listen on.\n Can be used several times to bind to several addresses.\n" \
|
||||
"--[ssh,ssl,...]: where to connect connections from corresponding protocol.\n" \
|
||||
"-P: PID file.\n" \
|
||||
"-i: Run as a inetd service.\n" \
|
||||
"";
|
||||
|
||||
/* Constants for options that have no one-character shorthand */
|
||||
#define OPT_ONTIMEOUT 257
|
||||
|
||||
@ -209,6 +186,12 @@ int main(int argc, char *argv[], char* envp[])
|
||||
if (res) exit(6);
|
||||
if (cfg.verbose > 3)
|
||||
sslhcfg_fprint(stderr, &cfg, 0);
|
||||
|
||||
if (cfg.version) {
|
||||
printf("%s %s\n", server_type, VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
config_protocols();
|
||||
config_sanity_check(&cfg);
|
||||
|
||||
|
@ -26,6 +26,9 @@ config: {
|
||||
type: "list",
|
||||
items: (
|
||||
{ name: "verbose"; type: "int"; default: 0; short: "v"; },
|
||||
{ name: "version"; type: "bool"; default: false;
|
||||
short: "V";
|
||||
description: "Print version information and exit"; },
|
||||
{ name: "foreground"; type: "bool"; default: false;
|
||||
short: "f";
|
||||
description: "Run in foreground instead of as a daemon"; },
|
||||
|
Loading…
x
Reference in New Issue
Block a user