mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 07:37:15 +03:00
add --anyprot command line option (fix #272)
This commit is contained in:
parent
ac8563525e
commit
d7cf82424b
26
sslh-conf.c
26
sslh-conf.c
@ -1,5 +1,5 @@
|
||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||
* on Fri Jul 17 21:57:49 2020.
|
||||
* on Sat Jul 18 17:26:18 2020.
|
||||
|
||||
# conf2struct: generate libconf parsers that read to structs
|
||||
# Copyright (C) 2018-2019 Yves Rutschle
|
||||
@ -312,6 +312,7 @@ struct arg_file* sslhcfg_conffile;
|
||||
struct arg_str* sslhcfg_http;
|
||||
struct arg_str* sslhcfg_adb;
|
||||
struct arg_str* sslhcfg_socks5;
|
||||
struct arg_str* sslhcfg_anyprot;
|
||||
struct arg_end* sslhcfg_end;
|
||||
|
||||
|
||||
@ -777,6 +778,14 @@ static struct config_desc table_sslhcfg[] = {
|
||||
},
|
||||
{ 0 }
|
||||
};
|
||||
static struct compound_cl_target sslhcfg_anyprot_targets [] = {
|
||||
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "anyprot" },
|
||||
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
|
||||
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
|
||||
{ & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static struct compound_cl_target sslhcfg_socks5_targets [] = {
|
||||
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "socks5" },
|
||||
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
|
||||
@ -961,6 +970,18 @@ static struct compound_cl_arg compound_cl_args[] = {
|
||||
.override_const = "socks5",
|
||||
},
|
||||
|
||||
{ /* arg: anyprot */
|
||||
.regex = "(.+):(\\w+)",
|
||||
.arg_cl = & sslhcfg_anyprot,
|
||||
.base_entry = & table_sslhcfg [12],
|
||||
.targets = sslhcfg_anyprot_targets,
|
||||
|
||||
|
||||
.override_desc = & table_sslhcfg_protocols [0],
|
||||
.override_matchindex = 0,
|
||||
.override_const = "anyprot",
|
||||
},
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -1474,6 +1495,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
|
||||
sslhcfg_http = arg_strn(NULL, "http", "<host:port>", 0, 10, "Set up HTTP (plain) target"),
|
||||
sslhcfg_adb = arg_strn(NULL, "adb", "<host:port>", 0, 10, "Set up ADB (Android Debug) target"),
|
||||
sslhcfg_socks5 = arg_strn(NULL, "socks5", "<host:port>", 0, 10, "Set up socks5 target"),
|
||||
sslhcfg_anyprot = arg_strn(NULL, "anyprot", "<host:port>", 0, 10, "Set up default target"),
|
||||
sslhcfg_end = arg_end(10)
|
||||
|
||||
};
|
||||
@ -1482,7 +1504,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
|
||||
nerrors = arg_parse(argc, argv, argtable);
|
||||
if (nerrors) {
|
||||
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
|
||||
arg_print_syntax(stdout, argtable, "\\n");
|
||||
arg_print_syntax(stdout, argtable, "\n");
|
||||
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||
* on Fri Jul 17 21:57:49 2020.
|
||||
* on Sat Jul 18 17:26:18 2020.
|
||||
|
||||
# conf2struct: generate libconf parsers that read to structs
|
||||
# Copyright (C) 2018-2019 Yves Rutschle
|
||||
|
11
sslhconf.cfg
11
sslhconf.cfg
@ -212,5 +212,16 @@ cl_groups: (
|
||||
{ path: "port"; value: "$2" },
|
||||
{ path: "log_level"; value: 1 }
|
||||
);
|
||||
},
|
||||
{ name: "anyprot"; pattern: "(.+):(\w+)"; description: "Set up default target";
|
||||
list: "protocols";
|
||||
override: "name";
|
||||
argdesc: "<host:port>";
|
||||
targets: (
|
||||
{ path: "name"; value: "anyprot" },
|
||||
{ path: "host"; value: "$1" },
|
||||
{ path: "port"; value: "$2" },
|
||||
{ path: "log_level"; value: 1 }
|
||||
);
|
||||
}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user