manual rerun bootstrap option
Some checks failed
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
ContinuousDelivery / linux-ubuntu (push) Failing after 4m34s
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Successful in 5m31s
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Successful in 5m31s
ContinuousIntegration / linux (push) Successful in 3m59s
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 5m18s
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 5m10s
Some checks failed
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
ContinuousDelivery / linux-ubuntu (push) Failing after 4m34s
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Successful in 5m31s
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Successful in 5m31s
ContinuousIntegration / linux (push) Successful in 3m59s
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 5m18s
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 5m10s
This commit is contained in:
parent
85b5c9200a
commit
a2001b34ea
@ -80,43 +80,7 @@ ToxClient::ToxClient(std::string_view save_path, std::string_view save_password)
|
|||||||
// no callbacks, use events
|
// no callbacks, use events
|
||||||
tox_events_init(_tox);
|
tox_events_init(_tox);
|
||||||
|
|
||||||
// dht bootstrap
|
runBootstrap();
|
||||||
{
|
|
||||||
struct DHT_node {
|
|
||||||
const char *ip;
|
|
||||||
uint16_t port;
|
|
||||||
const char key_hex[TOX_PUBLIC_KEY_SIZE*2 + 1]; // 1 for null terminator
|
|
||||||
unsigned char key_bin[TOX_PUBLIC_KEY_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
DHT_node nodes[] =
|
|
||||||
{
|
|
||||||
// TODO: more/diff nodes
|
|
||||||
// you can change or add your own bs and tcprelays here, ideally closer to you
|
|
||||||
|
|
||||||
//{"tox.plastiras.org", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
|
||||||
{"104.244.74.69", 443, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
|
||||||
{"104.244.74.69", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
|
||||||
|
|
||||||
//{"tox2.plastiras.org", 33445, "B6626D386BE7E3ACA107B46F48A5C4D522D29281750D44A0CBA6A2721E79C951", {}}, // DE tha14
|
|
||||||
|
|
||||||
//{"tox4.plastiras.org", 33445, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
|
||||||
{"37.221.66.161", 443, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
|
||||||
{"37.221.66.161", 33445, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
|
||||||
};
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(nodes)/sizeof(DHT_node); i ++) {
|
|
||||||
sodium_hex2bin(
|
|
||||||
nodes[i].key_bin, sizeof(nodes[i].key_bin),
|
|
||||||
nodes[i].key_hex, sizeof(nodes[i].key_hex)-1,
|
|
||||||
NULL, NULL, NULL
|
|
||||||
);
|
|
||||||
tox_bootstrap(_tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL);
|
|
||||||
// TODO: use extra tcp option to avoid error msgs
|
|
||||||
// ... this is hardcore
|
|
||||||
tox_add_tcp_relay(_tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxClient::~ToxClient(void) {
|
ToxClient::~ToxClient(void) {
|
||||||
@ -146,6 +110,45 @@ bool ToxClient::iterate(float time_delta) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToxClient::runBootstrap(void) {
|
||||||
|
// TODO: extend and read from json?
|
||||||
|
// TODO: seperate out relays
|
||||||
|
struct DHT_node {
|
||||||
|
const char *ip;
|
||||||
|
uint16_t port;
|
||||||
|
const char key_hex[TOX_PUBLIC_KEY_SIZE*2 + 1]; // 1 for null terminator
|
||||||
|
unsigned char key_bin[TOX_PUBLIC_KEY_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
DHT_node nodes[] =
|
||||||
|
{
|
||||||
|
// TODO: more/diff nodes
|
||||||
|
// you can change or add your own bs and tcprelays here, ideally closer to you
|
||||||
|
|
||||||
|
//{"tox.plastiras.org", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
||||||
|
{"104.244.74.69", 443, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
||||||
|
{"104.244.74.69", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // LU tha14
|
||||||
|
|
||||||
|
//{"tox2.plastiras.org", 33445, "B6626D386BE7E3ACA107B46F48A5C4D522D29281750D44A0CBA6A2721E79C951", {}}, // DE tha14
|
||||||
|
|
||||||
|
//{"tox4.plastiras.org", 33445, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
||||||
|
{"37.221.66.161", 443, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
||||||
|
{"37.221.66.161", 33445, "836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409", {}}, // MD tha14
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(nodes)/sizeof(DHT_node); i ++) {
|
||||||
|
sodium_hex2bin(
|
||||||
|
nodes[i].key_bin, sizeof(nodes[i].key_bin),
|
||||||
|
nodes[i].key_hex, sizeof(nodes[i].key_hex)-1,
|
||||||
|
NULL, NULL, NULL
|
||||||
|
);
|
||||||
|
tox_bootstrap(_tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL);
|
||||||
|
// TODO: use extra tcp option to avoid error msgs
|
||||||
|
// ... this is hardcore
|
||||||
|
tox_add_tcp_relay(_tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ToxClient::subscribeRaw(std::function<void(const Tox_Events*)> fn) {
|
void ToxClient::subscribeRaw(std::function<void(const Tox_Events*)> fn) {
|
||||||
_subscriber_raw = fn;
|
_subscriber_raw = fn;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ class ToxClient : public ToxDefaultImpl, public ToxEventProviderBase {
|
|||||||
void setToxProfilePath(const std::string& new_path) { _tox_profile_path = new_path; }
|
void setToxProfilePath(const std::string& new_path) { _tox_profile_path = new_path; }
|
||||||
void setSelfName(std::string_view new_name) { _self_name = new_name; toxSelfSetName(new_name); }
|
void setSelfName(std::string_view new_name) { _self_name = new_name; toxSelfSetName(new_name); }
|
||||||
|
|
||||||
|
void runBootstrap(void);
|
||||||
|
|
||||||
public: // raw events
|
public: // raw events
|
||||||
void subscribeRaw(std::function<void(const Tox_Events*)> fn);
|
void subscribeRaw(std::function<void(const Tox_Events*)> fn);
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#include "./tox_ui_utils.hpp"
|
#include "./tox_ui_utils.hpp"
|
||||||
|
|
||||||
|
#include "./tox_client.hpp"
|
||||||
|
|
||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
|
|
||||||
#include <solanaceae/toxcore/tox_interface.hpp>
|
|
||||||
#include <solanaceae/util/utils.hpp>
|
#include <solanaceae/util/utils.hpp>
|
||||||
|
|
||||||
#include <solanaceae/util/config_model.hpp>
|
#include <solanaceae/util/config_model.hpp>
|
||||||
@ -11,9 +12,9 @@
|
|||||||
#include <imgui/misc/cpp/imgui_stdlib.h>
|
#include <imgui/misc/cpp/imgui_stdlib.h>
|
||||||
|
|
||||||
ToxUIUtils::ToxUIUtils(
|
ToxUIUtils::ToxUIUtils(
|
||||||
ToxI& t,
|
ToxClient& tc,
|
||||||
ConfigModelI& conf
|
ConfigModelI& conf
|
||||||
) : _t(t), _conf(conf) {
|
) : _tc(tc), _conf(conf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToxUIUtils::render(void) {
|
void ToxUIUtils::render(void) {
|
||||||
@ -31,6 +32,13 @@ void ToxUIUtils::render(void) {
|
|||||||
if (ImGui::MenuItem("join Group by ID (ngc)")) {
|
if (ImGui::MenuItem("join Group by ID (ngc)")) {
|
||||||
_show_add_group_window = true;
|
_show_add_group_window = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SeparatorText("DHT");
|
||||||
|
|
||||||
|
if (ImGui::MenuItem("rerun bootstrap")) {
|
||||||
|
_tc.runBootstrap();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
@ -51,7 +59,7 @@ void ToxUIUtils::render(void) {
|
|||||||
static Tox_Err_Friend_Add err = Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK;
|
static Tox_Err_Friend_Add err = Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK;
|
||||||
if (ImGui::Button("add")) {
|
if (ImGui::Button("add")) {
|
||||||
// TODO: add string_view variant to utils
|
// TODO: add string_view variant to utils
|
||||||
auto [_, err_r] = _t.toxFriendAdd(hex2bin(std::string{tox_id}), message);
|
auto [_, err_r] = _tc.toxFriendAdd(hex2bin(std::string{tox_id}), message);
|
||||||
err = err_r;
|
err = err_r;
|
||||||
}
|
}
|
||||||
if (err != Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK) {
|
if (err != Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK) {
|
||||||
@ -78,7 +86,7 @@ void ToxUIUtils::render(void) {
|
|||||||
|
|
||||||
static Tox_Err_Group_Join err = Tox_Err_Group_Join::TOX_ERR_GROUP_JOIN_OK;
|
static Tox_Err_Group_Join err = Tox_Err_Group_Join::TOX_ERR_GROUP_JOIN_OK;
|
||||||
if (ImGui::Button("join")) {
|
if (ImGui::Button("join")) {
|
||||||
auto [_, err_r] = _t.toxGroupJoin(
|
auto [_, err_r] = _tc.toxGroupJoin(
|
||||||
hex2bin(std::string{chat_id}), // TODO: add string_view variant to utils
|
hex2bin(std::string{chat_id}), // TODO: add string_view variant to utils
|
||||||
self_name,
|
self_name,
|
||||||
password
|
password
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct ToxI;
|
class ToxClient;
|
||||||
struct ConfigModelI;
|
struct ConfigModelI;
|
||||||
|
|
||||||
class ToxUIUtils {
|
class ToxUIUtils {
|
||||||
bool _show_add_friend_window {false};
|
bool _show_add_friend_window {false};
|
||||||
bool _show_add_group_window {false};
|
bool _show_add_group_window {false};
|
||||||
|
|
||||||
ToxI& _t;
|
ToxClient& _tc;
|
||||||
ConfigModelI& _conf;
|
ConfigModelI& _conf;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToxUIUtils(
|
ToxUIUtils(
|
||||||
ToxI& t,
|
ToxClient& tc,
|
||||||
ConfigModelI& conf
|
ConfigModelI& conf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user