From f418ae6128b9aaf090df622634d2fbab503b720c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yves=20R=C5=B1tschl=C3=A9?= Date: Sun, 4 Sep 2022 18:48:17 +0200 Subject: [PATCH] added wireguard command-line setting --- sslh-conf.c | 25 ++++++++++++++++++++++++- sslh-conf.h | 2 +- sslhconf.cfg | 12 ++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/sslh-conf.c b/sslh-conf.c index 43f7643..e4e6dd7 100644 --- a/sslh-conf.c +++ b/sslh-conf.c @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Sat Apr 30 09:55:01 2022. + * on Sun Sep 4 18:47:04 2022. # conf2struct: generate libconf parsers that read to structs # Copyright (C) 2018-2021 Yves Rutschle @@ -473,6 +473,7 @@ struct arg_file* sslhcfg_conffile; struct arg_str* sslhcfg_tls; struct arg_str* sslhcfg_openvpn; struct arg_str* sslhcfg_tinc; + struct arg_str* sslhcfg_wireguard; struct arg_str* sslhcfg_xmpp; struct arg_str* sslhcfg_http; struct arg_str* sslhcfg_adb; @@ -1296,6 +1297,15 @@ static struct compound_cl_target sslhcfg_xmpp_targets [] = { { 0 } }; +static struct compound_cl_target sslhcfg_wireguard_targets [] = { + { & table_sslhcfg_protocols[0], 0, .value.def_string = "wireguard" }, + { & table_sslhcfg_protocols[1], 1, .value.def_string = "0" }, + { & table_sslhcfg_protocols[2], 2, .value.def_string = "0" }, + { & table_sslhcfg_protocols[10], 0, .value.def_int = 1 }, + { & table_sslhcfg_protocols[7], 0, .value.def_bool = 1 }, + { 0 } +}; + static struct compound_cl_target sslhcfg_tinc_targets [] = { { & table_sslhcfg_protocols[0], 0, .value.def_string = "tinc" }, { & table_sslhcfg_protocols[1], 1, .value.def_string = "0" }, @@ -1400,6 +1410,18 @@ static struct compound_cl_arg compound_cl_args[] = { .override_const = "tinc", }, + { /* arg: wireguard */ + .regex = "(.+):(\\w+)", + .arg_cl = & sslhcfg_wireguard, + .base_entry = & table_sslhcfg [26], + .targets = sslhcfg_wireguard_targets, + + + .override_desc = & table_sslhcfg_protocols [0], + .override_matchindex = 0, + .override_const = "wireguard", + }, + { /* arg: xmpp */ .regex = "(.+):(\\w+)", .arg_cl = & sslhcfg_xmpp, @@ -2158,6 +2180,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) sslhcfg_tls = arg_strn(NULL, "tls", "", 0, 10, "Set up TLS/SSL target"), sslhcfg_openvpn = arg_strn(NULL, "openvpn", "", 0, 10, "Set up OpenVPN target"), sslhcfg_tinc = arg_strn(NULL, "tinc", "", 0, 10, "Set up tinc target"), + sslhcfg_wireguard = arg_strn(NULL, "wireguard", "", 0, 10, "Set up WireGuard target"), sslhcfg_xmpp = arg_strn(NULL, "xmpp", "", 0, 10, "Set up XMPP target"), 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"), diff --git a/sslh-conf.h b/sslh-conf.h index 238ecc8..62cab82 100644 --- a/sslh-conf.h +++ b/sslh-conf.h @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Sat Apr 30 09:55:01 2022. + * on Sun Sep 4 18:47:04 2022. # conf2struct: generate libconf parsers that read to structs # Copyright (C) 2018-2021 Yves Rutschle diff --git a/sslhconf.cfg b/sslhconf.cfg index ea6c6b0..46d408b 100644 --- a/sslhconf.cfg +++ b/sslhconf.cfg @@ -210,6 +210,18 @@ cl_groups: ( { path: "tfo_ok"; value: 1 } ); }, + { name: "wireguard"; pattern: "(.+):(\w+)"; description: "Set up WireGuard target"; + list: "protocols"; + override: "name"; + argdesc: ""; + targets: ( + { path: "name"; value: "wireguard" }, + { path: "host"; value: "$1" }, + { path: "port"; value: "$2" }, + { path: "log_level"; value: 1 }, + { path: "tfo_ok"; value: 1 } + ); + }, { name: "xmpp"; pattern: "(.+):(\w+)"; description: "Set up XMPP target"; list: "protocols"; override: "name";