diff options
author | Aleksi Lindeman <aleksi_888@hotmail.com> | 2018-02-01 21:15:13 +0100 |
---|---|---|
committer | Aleksi Lindeman <aleksi_888@hotmail.com> | 2018-02-01 21:15:19 +0100 |
commit | 6f1089db78f14b52b869f5aaa979e52ff5e4c2d7 (patch) | |
tree | d79f7abfb0fb9f3d58f9716741512b63fb4193ec /src/main.cpp | |
parent | 80a9c135b8bdca64246f147f22d98485e0f05ee5 (diff) |
Sync time with ntp server, starting with basic operations
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 8e38e18..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include <opendht.h> -#include <vector> -#include "../include/Database.hpp" - -using namespace odhtdb; - -int main() -{ - Database database("bootstrap.ring.cx", 4222); - Key channelChatKey("galax.channel.CAGERIJF232dKADS528392fawdkf3fas.chat"); - const char *data = "hello, world!"; - database.add(channelChatKey, DataView{ (void*)data, strlen(data) }); - database.commit(); - - /* - Database database("bootstrap.ring.cx", 4222); - Key channelChatKey("galax.channel.CAGERIJF232dKADS528392fawdkf3fas.chat"); - database.add(channelChatKey, { localUser, date, "hello, world!" }); - */ - -#if 0 - dht::DhtRunner node; - - // Launch a dht node on a new thread, using a - // generated RSA key pair, and listen on port 4222. - node.run(4222, dht::crypto::generateIdentity(), true); - - // Join the network through any running node, - // here using a known bootstrap node. - node.bootstrap("bootstrap.ring.cx", "4222"); - - // put some data on the dht - std::vector<uint8_t> some_data(5, 10); - node.put("unique_key", some_data); - - // put some data on the dht, signed with our generated private key - node.putSigned("unique_key_42", some_data); - - // get data from the dht - node.get("other_unique_key", [](const std::vector<std::shared_ptr<dht::Value>>& values) { - // Callback called when values are found - for (const auto& value : values) - std::cout << "Found value: " << *value << std::endl; - return true; // return false to stop the search - }); - - // wait for dht threads to end - node.join(); - #endif - return 0; -}
\ No newline at end of file |