Squashed 'external/toxcore/c-toxcore/' changes from 03e9fbf3703..55752a2e2ef
55752a2e2ef fix(toxav): pass video bit rate as kbit Previously we unintentionally made it Mbit. 7e573280a75 docs(toxav): fix docs of toxav.h - fix units to be more readable - use width before height consistently - video -> audio typo 5f88a084e8c fix: friend_connections leak on allocation failure clean up when it only contains connections in the NONE state 6d27a1ae178 fix: wrong comment for closelist ce4f29e8036 cleanup: Fix all `-Wsign-compare` warnings. 4d4251c397f chore: lower cirrus ci timeout drastically 40676284507 fix: events leak that can occur if allocation fails rare in practice, found by fuzzing 9610ac31c5f fix: Return an error instead of crashing on nullptr args in NGC. a57c2c8f956 refactor: Make ToxAV independent of toxcore internals. 5752fc29f86 refactor: Make tox-bootstrapd use bool instead of int df675786eb2 chore: Add release-drafter github action. 03fd7a69dcf chore: Use toktok's cmp instead of upstream. 350c0ba1205 cleanup: Sort apk/apt install commands in Dockerfiles. 8c1bda502cb chore(deps): bump golang.org/x/net ddb9d3210da chore: Upgrade to FreeBSD 14.1 in cirrus build. e9076f45bd3 chore(cmake): set options changes as cache and with force git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 55752a2e2ef894bfa6d7a2a21a0278e3f2bede7d
This commit is contained in:
@ -27,7 +27,6 @@ run() {
|
||||
-Wno-missing-noreturn \
|
||||
-Wno-old-style-cast \
|
||||
-Wno-padded \
|
||||
-Wno-sign-compare \
|
||||
-Wno-switch-default \
|
||||
-Wno-tautological-pointer-compare \
|
||||
-Wno-unreachable-code-return \
|
||||
|
@ -20,8 +20,6 @@ CPPCHECK+=("--suppress=knownConditionTrueFalse")
|
||||
CPPCHECK+=("--suppress=missingIncludeSystem")
|
||||
# TODO(iphydf): Maybe fix?
|
||||
CPPCHECK+=("--suppress=signConversion")
|
||||
# TODO(iphydf): Fixed in the toxav refactor PR.
|
||||
CPPCHECK+=("--suppress=redundantAssignment")
|
||||
|
||||
# We use this for VLAs.
|
||||
CPPCHECK_CXX+=("--suppress=allocaCalled")
|
||||
|
@ -5,11 +5,11 @@ FROM alpine:3.19.0 AS build
|
||||
RUN ["apk", "--no-cache", "add",\
|
||||
"clang",\
|
||||
"cmake",\
|
||||
"linux-headers",\
|
||||
"libconfig-dev",\
|
||||
"libconfig-static",\
|
||||
"libsodium-dev",\
|
||||
"libsodium-static",\
|
||||
"linux-headers",\
|
||||
"musl-dev",\
|
||||
"ninja",\
|
||||
"python3"]
|
||||
|
@ -138,9 +138,20 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
|
||||
}
|
||||
}
|
||||
|
||||
// A wrapper function that actually takes a bool argument
|
||||
static int tox_config_lookup_bool(const config_t *config, const char *path, bool *bool_value)
|
||||
{
|
||||
int int_value = 0;
|
||||
if (config_lookup_bool(config, path, &int_value) == CONFIG_FALSE) {
|
||||
return CONFIG_FALSE;
|
||||
}
|
||||
*bool_value = int_value != 0;
|
||||
return CONFIG_TRUE;
|
||||
}
|
||||
|
||||
bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port,
|
||||
int *enable_ipv6, int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay,
|
||||
uint16_t **tcp_relay_ports, int *tcp_relay_port_count, int *enable_motd, char **motd)
|
||||
bool *enable_ipv6, bool *enable_ipv4_fallback, bool *enable_lan_discovery, bool *enable_tcp_relay,
|
||||
uint16_t **tcp_relay_ports, int *tcp_relay_port_count, bool *enable_motd, char **motd)
|
||||
{
|
||||
config_t cfg;
|
||||
|
||||
@ -207,14 +218,14 @@ bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **
|
||||
memcpy(*keys_file_path, tmp_keys_file, keys_file_path_len);
|
||||
|
||||
// Get IPv6 option
|
||||
if (config_lookup_bool(&cfg, NAME_ENABLE_IPV6, enable_ipv6) == CONFIG_FALSE) {
|
||||
if (tox_config_lookup_bool(&cfg, NAME_ENABLE_IPV6, enable_ipv6) == CONFIG_FALSE) {
|
||||
log_write(LOG_LEVEL_WARNING, "No '%s' setting in configuration file.\n", NAME_ENABLE_IPV6);
|
||||
log_write(LOG_LEVEL_WARNING, "Using default '%s': %s\n", NAME_ENABLE_IPV6, DEFAULT_ENABLE_IPV6 ? "true" : "false");
|
||||
*enable_ipv6 = DEFAULT_ENABLE_IPV6;
|
||||
}
|
||||
|
||||
// Get IPv4 fallback option
|
||||
if (config_lookup_bool(&cfg, NAME_ENABLE_IPV4_FALLBACK, enable_ipv4_fallback) == CONFIG_FALSE) {
|
||||
if (tox_config_lookup_bool(&cfg, NAME_ENABLE_IPV4_FALLBACK, enable_ipv4_fallback) == CONFIG_FALSE) {
|
||||
log_write(LOG_LEVEL_WARNING, "No '%s' setting in configuration file.\n", NAME_ENABLE_IPV4_FALLBACK);
|
||||
log_write(LOG_LEVEL_WARNING, "Using default '%s': %s\n", NAME_ENABLE_IPV4_FALLBACK,
|
||||
DEFAULT_ENABLE_IPV4_FALLBACK ? "true" : "false");
|
||||
@ -222,7 +233,7 @@ bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **
|
||||
}
|
||||
|
||||
// Get LAN discovery option
|
||||
if (config_lookup_bool(&cfg, NAME_ENABLE_LAN_DISCOVERY, enable_lan_discovery) == CONFIG_FALSE) {
|
||||
if (tox_config_lookup_bool(&cfg, NAME_ENABLE_LAN_DISCOVERY, enable_lan_discovery) == CONFIG_FALSE) {
|
||||
log_write(LOG_LEVEL_WARNING, "No '%s' setting in configuration file.\n", NAME_ENABLE_LAN_DISCOVERY);
|
||||
log_write(LOG_LEVEL_WARNING, "Using default '%s': %s\n", NAME_ENABLE_LAN_DISCOVERY,
|
||||
DEFAULT_ENABLE_LAN_DISCOVERY ? "true" : "false");
|
||||
@ -230,28 +241,28 @@ bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **
|
||||
}
|
||||
|
||||
// Get TCP relay option
|
||||
if (config_lookup_bool(&cfg, NAME_ENABLE_TCP_RELAY, enable_tcp_relay) == CONFIG_FALSE) {
|
||||
if (tox_config_lookup_bool(&cfg, NAME_ENABLE_TCP_RELAY, enable_tcp_relay) == CONFIG_FALSE) {
|
||||
log_write(LOG_LEVEL_WARNING, "No '%s' setting in configuration file.\n", NAME_ENABLE_TCP_RELAY);
|
||||
log_write(LOG_LEVEL_WARNING, "Using default '%s': %s\n", NAME_ENABLE_TCP_RELAY,
|
||||
DEFAULT_ENABLE_TCP_RELAY ? "true" : "false");
|
||||
*enable_tcp_relay = DEFAULT_ENABLE_TCP_RELAY;
|
||||
}
|
||||
|
||||
if (*enable_tcp_relay != 0) {
|
||||
if (*enable_tcp_relay) {
|
||||
parse_tcp_relay_ports_config(&cfg, tcp_relay_ports, tcp_relay_port_count);
|
||||
} else {
|
||||
*tcp_relay_port_count = 0;
|
||||
}
|
||||
|
||||
// Get MOTD option
|
||||
if (config_lookup_bool(&cfg, NAME_ENABLE_MOTD, enable_motd) == CONFIG_FALSE) {
|
||||
if (tox_config_lookup_bool(&cfg, NAME_ENABLE_MOTD, enable_motd) == CONFIG_FALSE) {
|
||||
log_write(LOG_LEVEL_WARNING, "No '%s' setting in configuration file.\n", NAME_ENABLE_MOTD);
|
||||
log_write(LOG_LEVEL_WARNING, "Using default '%s': %s\n", NAME_ENABLE_MOTD,
|
||||
DEFAULT_ENABLE_MOTD ? "true" : "false");
|
||||
*enable_motd = DEFAULT_ENABLE_MOTD;
|
||||
}
|
||||
|
||||
if (*enable_motd != 0) {
|
||||
if (*enable_motd) {
|
||||
// Get MOTD
|
||||
const char *tmp_motd;
|
||||
|
||||
@ -273,14 +284,14 @@ bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_PID_FILE_PATH, *pid_file_path);
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_KEYS_FILE_PATH, *keys_file_path);
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %d\n", NAME_PORT, *port);
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_IPV6, *enable_ipv6 != 0 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_IPV4_FALLBACK, *enable_ipv4_fallback != 0 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_LAN_DISCOVERY, *enable_lan_discovery != 0 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_IPV6, *enable_ipv6 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_IPV4_FALLBACK, *enable_ipv4_fallback ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_LAN_DISCOVERY, *enable_lan_discovery ? "true" : "false");
|
||||
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_TCP_RELAY, *enable_tcp_relay != 0 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_TCP_RELAY, *enable_tcp_relay ? "true" : "false");
|
||||
|
||||
// Show info about tcp ports only if tcp relay is enabled
|
||||
if (*enable_tcp_relay != 0) {
|
||||
if (*enable_tcp_relay) {
|
||||
if (*tcp_relay_port_count == 0) {
|
||||
log_write(LOG_LEVEL_ERROR, "No TCP ports could be read.\n");
|
||||
} else {
|
||||
@ -292,9 +303,9 @@ bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **
|
||||
}
|
||||
}
|
||||
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_MOTD, *enable_motd != 0 ? "true" : "false");
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_ENABLE_MOTD, *enable_motd ? "true" : "false");
|
||||
|
||||
if (*enable_motd != 0) {
|
||||
if (*enable_motd) {
|
||||
log_write(LOG_LEVEL_INFO, "'%s': %s\n", NAME_MOTD, *motd);
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,14 @@
|
||||
*
|
||||
* Important: You are responsible for freeing `pid_file_path` and `keys_file_path`
|
||||
* also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports`
|
||||
* and also `motd` iff `enable_motd` is set.
|
||||
* and also `motd` iff `enable_motd` is true.
|
||||
*
|
||||
* @return true on success,
|
||||
* false on failure, doesn't modify any data pointed by arguments.
|
||||
*/
|
||||
bool get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port,
|
||||
int *enable_ipv6, int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay,
|
||||
uint16_t **tcp_relay_ports, int *tcp_relay_port_count, int *enable_motd, char **motd);
|
||||
bool *enable_ipv6, bool *enable_ipv4_fallback, bool *enable_lan_discovery, bool *enable_tcp_relay,
|
||||
uint16_t **tcp_relay_ports, int *tcp_relay_port_count, bool *enable_motd, char **motd);
|
||||
|
||||
/**
|
||||
* Bootstraps off nodes listed in the config file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* Copyright © 2016-2023 The TokTok team.
|
||||
* Copyright © 2016-2024 The TokTok team.
|
||||
* Copyright © 2014-2016 Tox project.
|
||||
*/
|
||||
|
||||
@ -10,17 +10,19 @@
|
||||
#ifndef C_TOXCORE_OTHER_BOOTSTRAP_DAEMON_SRC_CONFIG_DEFAULTS_H
|
||||
#define C_TOXCORE_OTHER_BOOTSTRAP_DAEMON_SRC_CONFIG_DEFAULTS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define DEFAULT_PID_FILE_PATH "tox-bootstrapd.pid"
|
||||
#define DEFAULT_KEYS_FILE_PATH "tox-bootstrapd.keys"
|
||||
#define DEFAULT_PORT 33445
|
||||
#define DEFAULT_ENABLE_IPV6 1 // 1 - true, 0 - false
|
||||
#define DEFAULT_ENABLE_IPV4_FALLBACK 1 // 1 - true, 0 - false
|
||||
#define DEFAULT_ENABLE_LAN_DISCOVERY 1 // 1 - true, 0 - false
|
||||
#define DEFAULT_ENABLE_TCP_RELAY 1 // 1 - true, 0 - false
|
||||
#define DEFAULT_ENABLE_IPV6 true
|
||||
#define DEFAULT_ENABLE_IPV4_FALLBACK true
|
||||
#define DEFAULT_ENABLE_LAN_DISCOVERY true
|
||||
#define DEFAULT_ENABLE_TCP_RELAY true
|
||||
#define DEFAULT_TCP_RELAY_PORTS 443, 3389, 33445 // comma-separated list of ports
|
||||
#define DEFAULT_ENABLE_MOTD 1 // 1 - true, 0 - false
|
||||
#define DEFAULT_ENABLE_MOTD true
|
||||
#define DEFAULT_MOTD DAEMON_NAME
|
||||
|
||||
#endif // C_TOXCORE_OTHER_BOOTSTRAP_DAEMON_SRC_CONFIG_DEFAULTS_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* Copyright © 2016-2018 The TokTok team.
|
||||
* Copyright © 2016-2024 The TokTok team.
|
||||
* Copyright © 2014-2016 Tox project.
|
||||
*/
|
||||
|
||||
@ -240,13 +240,13 @@ int main(int argc, char *argv[])
|
||||
char *pid_file_path = nullptr;
|
||||
char *keys_file_path = nullptr;
|
||||
int start_port = 0;
|
||||
int enable_ipv6 = 0;
|
||||
int enable_ipv4_fallback = 0;
|
||||
int enable_lan_discovery = 0;
|
||||
int enable_tcp_relay = 0;
|
||||
bool enable_ipv6 = false;
|
||||
bool enable_ipv4_fallback = false;
|
||||
bool enable_lan_discovery = false;
|
||||
bool enable_tcp_relay = false;
|
||||
uint16_t *tcp_relay_ports = nullptr;
|
||||
int tcp_relay_port_count = 0;
|
||||
int enable_motd = 0;
|
||||
bool enable_motd = false;
|
||||
char *motd = nullptr;
|
||||
|
||||
if (get_general_config(cfg_file_path, &pid_file_path, &keys_file_path, &start_port, &enable_ipv6, &enable_ipv4_fallback,
|
||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
free(pid_file_path);
|
||||
|
||||
IP ip;
|
||||
ip_init(&ip, enable_ipv6 != 0);
|
||||
ip_init(&ip, enable_ipv6);
|
||||
|
||||
Logger *logger = logger_new();
|
||||
|
||||
@ -296,10 +296,10 @@ int main(int argc, char *argv[])
|
||||
Networking_Core *net = new_networking_ex(logger, mem, ns, &ip, start_port, end_port, nullptr);
|
||||
|
||||
if (net == nullptr) {
|
||||
if (enable_ipv6 != 0 && enable_ipv4_fallback != 0) {
|
||||
if (enable_ipv6 && enable_ipv4_fallback) {
|
||||
log_write(LOG_LEVEL_WARNING, "Couldn't initialize IPv6 networking. Falling back to using IPv4.\n");
|
||||
enable_ipv6 = 0;
|
||||
ip_init(&ip, enable_ipv6 != 0);
|
||||
enable_ipv6 = false;
|
||||
ip_init(&ip, enable_ipv6);
|
||||
net = new_networking_ex(logger, mem, ns, &ip, start_port, end_port, nullptr);
|
||||
|
||||
if (net == nullptr) {
|
||||
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
mono_time_update(mono_time);
|
||||
|
||||
DHT *const dht = new_dht(logger, mem, rng, ns, mono_time, net, true, enable_lan_discovery != 0);
|
||||
DHT *const dht = new_dht(logger, mem, rng, ns, mono_time, net, true, enable_lan_discovery);
|
||||
|
||||
if (dht == nullptr) {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n");
|
||||
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
gca_onion_init(group_announce, onion_a);
|
||||
|
||||
if (enable_motd != 0) {
|
||||
if (enable_motd) {
|
||||
if (bootstrap_set_callbacks(dht_get_net(dht), DAEMON_VERSION_NUMBER, (uint8_t *)motd, strlen(motd) + 1) == 0) {
|
||||
log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n");
|
||||
free(motd);
|
||||
@ -472,7 +472,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
TCP_Server *tcp_server = nullptr;
|
||||
|
||||
if (enable_tcp_relay != 0) {
|
||||
if (enable_tcp_relay) {
|
||||
if (tcp_relay_port_count == 0) {
|
||||
log_write(LOG_LEVEL_ERROR, "No TCP relay ports read. Exiting.\n");
|
||||
kill_onion_announce(onion_a);
|
||||
@ -488,7 +488,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
tcp_server = new_tcp_server(logger, mem, rng, ns, enable_ipv6 != 0,
|
||||
tcp_server = new_tcp_server(logger, mem, rng, ns, enable_ipv6,
|
||||
tcp_relay_port_count, tcp_relay_ports,
|
||||
dht_get_self_secret_key(dht), onion, forwarding);
|
||||
|
||||
@ -535,7 +535,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6 != 0)) {
|
||||
if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
|
||||
log_write(LOG_LEVEL_INFO, "List of bootstrap nodes read successfully.\n");
|
||||
} else {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path);
|
||||
@ -561,7 +561,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Broadcast_Info *broadcast = nullptr;
|
||||
|
||||
if (enable_lan_discovery != 0) {
|
||||
if (enable_lan_discovery) {
|
||||
broadcast = lan_discovery_init(ns);
|
||||
log_write(LOG_LEVEL_INFO, "Initialized LAN discovery successfully.\n");
|
||||
}
|
||||
@ -589,12 +589,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
do_dht(dht);
|
||||
|
||||
if (enable_lan_discovery != 0 && mono_time_is_timeout(mono_time, last_lan_discovery, LAN_DISCOVERY_INTERVAL)) {
|
||||
if (enable_lan_discovery && mono_time_is_timeout(mono_time, last_lan_discovery, LAN_DISCOVERY_INTERVAL)) {
|
||||
lan_discovery_send(dht_get_net(dht), broadcast, dht_get_self_public_key(dht), net_htons_port);
|
||||
last_lan_discovery = mono_time_get(mono_time);
|
||||
}
|
||||
|
||||
if (enable_tcp_relay != 0) {
|
||||
if (enable_tcp_relay) {
|
||||
do_tcp_server(tcp_server, mono_time);
|
||||
}
|
||||
|
||||
@ -618,7 +618,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
default:
|
||||
log_write(LOG_LEVEL_INFO, "Received (%d) signal. Exiting.\n", caught_signal);
|
||||
log_write(LOG_LEVEL_INFO, "Received (%ld) signal. Exiting.\n", (long)caught_signal);
|
||||
}
|
||||
|
||||
lan_discovery_kill(broadcast);
|
||||
|
@ -4,4 +4,4 @@ go 1.17
|
||||
|
||||
require github.com/gorilla/websocket v1.5.1
|
||||
|
||||
require golang.org/x/net v0.17.0 // indirect
|
||||
require golang.org/x/net v0.23.0 // indirect
|
||||
|
@ -4,6 +4,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@ -11,8 +13,10 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -24,17 +28,22 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
|
@ -3,10 +3,10 @@ FROM alpine:3.14.0
|
||||
RUN ["apk", "add", "--no-cache", \
|
||||
"bash", \
|
||||
"gcc", \
|
||||
"linux-headers", \
|
||||
"musl-dev", \
|
||||
"libsodium-dev", \
|
||||
"libvpx-dev", \
|
||||
"linux-headers", \
|
||||
"musl-dev", \
|
||||
"opus-dev", \
|
||||
"perf"]
|
||||
|
||||
|
@ -444,7 +444,10 @@ void generate_event_impl(const std::string& event_name, const std::vector<EventT
|
||||
f << " Tox_Event event;\n";
|
||||
f << " event.type = TOX_EVENT_" << str_toupper(event_name) << ";\n";
|
||||
f << " event.data." << event_name_l << " = " << event_name_l << ";\n\n";
|
||||
f << " tox_events_add(events, &event);\n";
|
||||
f << " if (!tox_events_add(events, &event)) {\n";
|
||||
f << " tox_event_" << event_name_l << "_free(" << event_name_l << ", mem);\n";
|
||||
f << " return nullptr;\n";
|
||||
f << " }\n";
|
||||
f << " return " << event_name_l << ";\n}\n\n";
|
||||
|
||||
// unpack
|
||||
|
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
printf("Failed to set status. Error number: %d\n", err);
|
||||
}
|
||||
|
||||
for (unsigned int i = 2; i < argc; i++) { //start at 2 because that is where the tox ids are
|
||||
for (int i = 2; i < argc; i++) { //start at 2 because that is where the tox ids are
|
||||
uint8_t *address = hex_string_to_bin(argv[i]);
|
||||
Tox_Err_Friend_Add friend_err;
|
||||
tox_friend_add(tox, address, (const uint8_t *)GENERATED_REQUEST_MESSAGE, strlen(GENERATED_REQUEST_MESSAGE),
|
||||
@ -145,7 +145,7 @@ int main(int argc, char *argv[])
|
||||
free(address);
|
||||
|
||||
if (friend_err != TOX_ERR_FRIEND_ADD_OK) {
|
||||
printf("Failed to add friend number %u. Error number: %d\n", i - 1, friend_err);
|
||||
printf("Failed to add friend number %d. Error number: %d\n", i - 1, friend_err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ static int load_file(const char *filename, unsigned char **result)
|
||||
fseek(f, 0, SEEK_SET);
|
||||
*result = (unsigned char *)malloc(size + 1);
|
||||
|
||||
if (size != fread(*result, sizeof(char), size, f)) {
|
||||
if ((size_t)size != fread(*result, sizeof(char), size, f)) {
|
||||
free(*result);
|
||||
fclose(f);
|
||||
return -2; // -2 means file reading fail
|
||||
@ -55,13 +55,13 @@ int main(int argc, char *argv[])
|
||||
crypto_sign_ed25519_keypair(pk, sk);
|
||||
printf("Public key:\n");
|
||||
|
||||
for (int i = 0; i < crypto_sign_ed25519_PUBLICKEYBYTES; ++i) {
|
||||
for (uint32_t i = 0; i < crypto_sign_ed25519_PUBLICKEYBYTES; ++i) {
|
||||
printf("%02X", pk[i]);
|
||||
}
|
||||
|
||||
printf("\nSecret key:\n");
|
||||
|
||||
for (int i = 0; i < crypto_sign_ed25519_SECRETKEYBYTES; ++i) {
|
||||
for (uint32_t i = 0; i < crypto_sign_ed25519_SECRETKEYBYTES; ++i) {
|
||||
printf("%02X", sk[i]);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
crypto_box_keypair(public_key, secret_key);
|
||||
|
||||
for (int i = 0; i <= crypto_box_PUBLICKEYBYTES - len; ++i) {
|
||||
for (uint32_t i = 0; i <= crypto_box_PUBLICKEYBYTES - len; ++i) {
|
||||
if (memcmp(public_key + i, desired_bin, len) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user