diff --git a/sslh-conf.c b/sslh-conf.c index bd84061..e5ec8e1 100644 --- a/sslh-conf.c +++ b/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", "", 0, 10, "Set up HTTP (plain) target"), sslhcfg_adb = arg_strn(NULL, "adb", "", 0, 10, "Set up ADB (Android Debug) target"), sslhcfg_socks5 = arg_strn(NULL, "socks5", "", 0, 10, "Set up socks5 target"), + sslhcfg_anyprot = arg_strn(NULL, "anyprot", "", 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; } diff --git a/sslh-conf.h b/sslh-conf.h index 7c517b2..435a7be 100644 --- a/sslh-conf.h +++ b/sslh-conf.h @@ -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 diff --git a/sslhconf.cfg b/sslhconf.cfg index 22ef3a7..7033f67 100644 --- a/sslhconf.cfg +++ b/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: ""; + targets: ( + { path: "name"; value: "anyprot" }, + { path: "host"; value: "$1" }, + { path: "port"; value: "$2" }, + { path: "log_level"; value: 1 } + ); } )