This commit is contained in:
Mike
2021-01-29 10:12:21 -07:00
5 changed files with 40 additions and 7 deletions

14
.github/semantic.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
allowMergeCommits: true
# Always validate the PR title AND all the commits
titleAndCommits: true
types:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- revert

View File

@@ -126,4 +126,9 @@ bool args_get_info(int argc, char* argv[], std::string& info)
bool args_get_verbose(int argc, char* argv[])
{
return get_arg_exists(argc, argv, "--verbose", "-v");
}
}
bool args_get_nocertcheck(int argc, char* argv[])
{
return get_arg_exists(argc, argv, "--nocertcheck", "-n");
}

1
args.h
View File

@@ -16,5 +16,6 @@ bool args_get_cmd(int argc, char* argv[], std::string& cmd);
bool args_get_dns(int argc, char* argv[], std::string& dns);
bool args_get_info(int argc, char* argv[], std::string& info);
bool args_get_verbose(int argc, char* argv[]);
bool args_get_nocertcheck(int argc, char* argv[]);
#endif

View File

@@ -60,6 +60,7 @@ int main(int argc, char* argv[])
std::string arg_dns;
std::string arg_info;
bool arg_verbose = false;
bool arg_nocertcheck = false;
if (argc == 1)
{
@@ -116,6 +117,13 @@ int main(int argc, char* argv[])
arg_verbose = true;
}
// no websocket server certificate verification
if (args_get_nocertcheck(argc, argv))
{
arg_nocertcheck = true;
}
// Print version info
usage_show_version();
@@ -160,11 +168,15 @@ int main(int argc, char* argv[])
{
client_config.set_proxy(web::web_proxy(utility::conversions::to_string_t(arg_proxy)));
}
#ifdef DEBUG
// skip certificate verification if debug build
std::cout << "Skipping certificate verification." << std::endl;
client_config.set_validate_certificates(false);
#endif
// websocket server certificate verification
if (arg_nocertcheck)
{
// skip websocket server certificate verification
std::cout << "Skipping certificate verification." << std::endl;
client_config.set_validate_certificates(false);
}
web::websockets::client::websocket_callback_client client(client_config);
std::condition_variable cv;
std::mutex mx;

View File

@@ -25,6 +25,7 @@ void usage_show_help()
std::cout << "Optional:" << std::endl;
std::cout << " -p, --proxy <addr> proxy address and port" << std::endl;
std::cout << " -d, --dns <dns> dns suffix override" << std::endl;
std::cout << " -n, --nocertcheck skip websocket server certificate verification" << std::endl;
std::cout << " -v, --verbose verbose output" << std::endl;
std::cout << std::endl;
std::cout << "Informational:" << std::endl;
@@ -69,4 +70,4 @@ void usage_show_version()
std::cout << project_name << " " << PROJECT_VER << "." << std::endl;
std::cout << "Protocol " << PROTOCOL_VERSION << "." << std::endl;
}
}