aboutsummaryrefslogtreecommitdiff
path: root/client/main.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-10 15:52:14 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-10 15:52:14 +0200
commitd8e48c32f8435076382543edfafbf81c223f9e87 (patch)
tree575f0f7f452c4c8800e77c7fd79b4354fed8a81c /client/main.cpp
parentfa35c9c3c71243a7f8537e5a81f7a09fa05a382e (diff)
downloadcmix-d8e48c32f8435076382543edfafbf81c223f9e87.tar.gz
cmix-d8e48c32f8435076382543edfafbf81c223f9e87.tar.bz2
cmix-d8e48c32f8435076382543edfafbf81c223f9e87.zip
Added a Client so we can start finishing up the setup phase of cMix.
Diffstat (limited to 'client/main.cpp')
-rw-r--r--client/main.cpp51
1 files changed, 51 insertions, 0 deletions
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 <boost/program_options.hpp>
+
+#include <vector>
+#include <iostream>
+
+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<std::vector<std::string>>()->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<std::string> network;
+ if(vm.count("network")) {
+ network = vm["network"].as<std::vector<std::string>>();
+ } else {
+ std::cerr << "network option is required." << std::endl;
+ return -1;
+ }
+
+ std::vector<NodeDetails> 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();
+}