From d8e48c32f8435076382543edfafbf81c223f9e87 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Mon, 10 Oct 2016 15:52:14 +0200 Subject: Added a Client so we can start finishing up the setup phase of cMix. --- client/main.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 client/main.cpp (limited to 'client/main.cpp') diff --git a/client/main.cpp b/client/main.cpp new file mode 100644 index 0000000..fb05171 --- /dev/null +++ b/client/main.cpp @@ -0,0 +1,51 @@ + +#include "cmixclient.hpp" + +#include "uriparser.hpp" +#include "logging.hpp" + +#include + +#include +#include + +int main(int argc, char* argv[]) { + namespace po = boost::program_options; + + init_logging(boost::log::trivial::severity_level::trace, "client"); + + BOOST_LOG_TRIVIAL(info) << "Started node"; + + po::options_description desc("Allowed options"); + desc.add_options() + ("help,h", "produce help message.") + ("network,n", po::value>()->multitoken(), "The addresses of the network nodes in order") + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << "\n"; + return 0; + } + + std::vector network; + if(vm.count("network")) { + network = vm["network"].as>(); + } else { + std::cerr << "network option is required." << std::endl; + return -1; + } + + std::vector node_details; + for(auto&& node : network) { + Uri uri = parse_uri(node); + + node_details.push_back({uri.host, uri.port}); + } + + CMixClient cmix_client(node_details); + cmix_client.run(); +} -- cgit v1.2.3-70-g09d2