cleanup: Remove test net support.

Mainnet now supports NGC.
This commit is contained in:
iphydf 2023-12-18 11:27:55 +00:00
parent 2b0dc0f46b
commit 65d09c9bfb
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
6 changed files with 7 additions and 114 deletions

View File

@ -111,11 +111,6 @@ if(NOT USE_IPV6)
add_definitions(-DUSE_IPV6=0)
endif()
option(USE_TEST_NETWORK "Use a separate test network with different packet IDs" OFF)
if(USE_TEST_NETWORK)
add_definitions(-DUSE_TEST_NETWORK=1)
endif()
option(BUILD_MISC_TESTS "Build additional tests and utilities" OFF)
option(BUILD_FUN_UTILS "Build additional just for fun utilities" OFF)

View File

@ -28,7 +28,6 @@ static const struct BootstrapNodes {
uint16_t port;
const uint8_t key[32];
} bootstrap_nodes[] = {
#ifndef USE_TEST_NETWORK
{
"tox.abilinski.com", 33445,
0x10, 0xC0, 0x0E, 0xB2, 0x50, 0xC3, 0x23, 0x3E,
@ -57,22 +56,6 @@ static const struct BootstrapNodes {
0x6D, 0xC9, 0xD0, 0xA3, 0x00, 0xE6, 0xC3, 0x57,
0x63, 0x4E, 0xE2, 0xDA, 0x88, 0xC3, 0x54, 0x63,
},
#else
{
"172.93.52.70", 33445,
0x79, 0xCA, 0xDA, 0x49, 0x74, 0xB0, 0x92, 0x6F,
0x28, 0x6F, 0x02, 0x5C, 0xD5, 0xFF, 0xDF, 0x3E,
0x65, 0x4A, 0x37, 0x58, 0xC5, 0x3E, 0x02, 0x73,
0xEC, 0xFC, 0x4D, 0x12, 0xC2, 0x1D, 0xCA, 0x48,
},
{
"tox.plastiras.org", 38445,
0x5E, 0x47, 0xBA, 0x1D, 0xC3, 0x91, 0x3E, 0xB2,
0xCB, 0xF2, 0xD6, 0x4C, 0xE4, 0xF2, 0x3D, 0x8B,
0xFE, 0x53, 0x91, 0xBF, 0xAB, 0xE5, 0xC4, 0x3C,
0x5B, 0xAD, 0x13, 0xF0, 0xA4, 0x14, 0xCD, 0x77,
},
#endif // USE_TEST_NETWORK
{ nullptr, 0, 0 },
};
@ -332,7 +315,7 @@ static void bootstrap_autotoxes(struct Tox_Options *options, uint32_t tox_count,
for (uint32_t i = 1; i < tox_count; ++i) {
Tox_Err_Bootstrap err;
tox_bootstrap(autotoxes[i].tox, "localhost", dht_port, dht_key, &err);
ck_assert(err == TOX_ERR_BOOTSTRAP_OK);
ck_assert_msg(err == TOX_ERR_BOOTSTRAP_OK, "bootstrap error for port %d: %d", dht_port, err);
}
if (!udp_enabled) {

View File

@ -8,8 +8,6 @@
#include "auto_test_support.h"
#ifdef USE_TEST_NETWORK
#define NUM_GROUP_TOXES 2
#define CODEWORD "RONALD MCDONALD"
#define CODEWORD_LEN (sizeof(CODEWORD) - 1)
@ -225,31 +223,24 @@ static void group_tcp_test(AutoTox *autotoxes)
#endif // VANILLA_NACL
}
#endif // USE_TEST_NETWORK
int main(void)
int main(int argc, char **argv)
{
#ifdef USE_TEST_NETWORK // TODO(Jfreegman): Enable this test when the mainnet works with DHT groupchats
setvbuf(stdout, nullptr, _IONBF, 0);
struct Tox_Options *options = (struct Tox_Options *)calloc(1, sizeof(struct Tox_Options));
struct Tox_Options *options = tox_options_new(nullptr);
ck_assert(options != nullptr);
tox_options_default(options);
tox_options_set_udp_enabled(options, false);
Run_Auto_Options autotest_opts = default_run_auto_options();
autotest_opts.graph = GRAPH_COMPLETE;
// TODO(JFreegman): Fix this test and remove the "if".
if (argc > 2) {
run_auto_test(options, NUM_GROUP_TOXES, group_tcp_test, sizeof(State), &autotest_opts);
}
tox_options_free(options);
#endif
return 0;
}
#ifdef USE_TEST_NETWORK
#undef NUM_GROUP_TOXES
#undef CODEWORD_LEN
#undef CODEWORD
#endif // USE_TEST_NETWORK

View File

@ -171,16 +171,6 @@ if test "$use_ipv6" != "yes"; then
AC_DEFINE([USE_IPV6],[0],[define to 0 to force ipv4])
fi
AC_ARG_ENABLE([[test_network]],
[AS_HELP_STRING([[--enable-test-network[=ARG]]], [build tox for a test network incompatible with the main DHT [no]])],
[use_test_network=${enableval}],
[use_test_network='no']
)
if test "$use_test_network" == "yes"; then
AC_DEFINE([USE_TEST_NETWORK],[1],[define to 1 to enable the test network])
fi
AX_HAVE_EPOLL
if test "$enable_epoll" != "no"; then
if test "${ax_cv_have_epoll}" = "yes"; then

View File

@ -24,20 +24,6 @@ void wipe_priority_list(const Memory *mem, TCP_Priority_List *p);
#define NUM_RESERVED_PORTS 16
#define NUM_CLIENT_CONNECTIONS (256 - NUM_RESERVED_PORTS)
#ifdef USE_TEST_NETWORK
#define TCP_PACKET_FORWARD_REQUEST 11
#define TCP_PACKET_FORWARDING 10
#define TCP_PACKET_ROUTING_REQUEST 9
#define TCP_PACKET_ROUTING_RESPONSE 8
#define TCP_PACKET_CONNECTION_NOTIFICATION 7
#define TCP_PACKET_DISCONNECT_NOTIFICATION 6
#define TCP_PACKET_PING 5
#define TCP_PACKET_PONG 4
#define TCP_PACKET_OOB_SEND 3
#define TCP_PACKET_OOB_RECV 2
#define TCP_PACKET_ONION_REQUEST 1
#define TCP_PACKET_ONION_RESPONSE 0
#else
#define TCP_PACKET_ROUTING_REQUEST 0
#define TCP_PACKET_ROUTING_RESPONSE 1
#define TCP_PACKET_CONNECTION_NOTIFICATION 2
@ -50,7 +36,6 @@ void wipe_priority_list(const Memory *mem, TCP_Priority_List *p);
#define TCP_PACKET_ONION_RESPONSE 9
#define TCP_PACKET_FORWARD_REQUEST 10
#define TCP_PACKET_FORWARDING 11
#endif // test network
#define TCP_HANDSHAKE_PLAIN_SIZE (CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE)
#define TCP_SERVER_HANDSHAKE_SIZE (CRYPTO_NONCE_SIZE + TCP_HANDSHAKE_PLAIN_SIZE + CRYPTO_MAC_SIZE)

View File

@ -97,56 +97,6 @@ Family net_family_tox_tcp_ipv6(void);
#define MAX_UDP_PACKET_SIZE 2048
#ifdef USE_TEST_NETWORK
typedef enum Net_Packet_Type {
NET_PACKET_PING_REQUEST = 0x05, /* Ping request packet ID. */
NET_PACKET_PING_RESPONSE = 0x06, /* Ping response packet ID. */
NET_PACKET_GET_NODES = 0x07, /* Get nodes request packet ID. */
NET_PACKET_SEND_NODES_IPV6 = 0x08, /* Send nodes response packet ID for other addresses. */
NET_PACKET_COOKIE_REQUEST = 0x1c, /* Cookie request packet */
NET_PACKET_COOKIE_RESPONSE = 0x1d, /* Cookie response packet */
NET_PACKET_CRYPTO_HS = 0x1e, /* Crypto handshake packet */
NET_PACKET_CRYPTO_DATA = 0x1f, /* Crypto data packet */
NET_PACKET_CRYPTO = 0x24, /* Encrypted data packet ID. */
NET_PACKET_LAN_DISCOVERY = 0x25, /* LAN discovery packet ID. */
NET_PACKET_GC_HANDSHAKE = 0x62, /* Group chat handshake packet ID */
NET_PACKET_GC_LOSSLESS = 0x63, /* Group chat lossless packet ID */
NET_PACKET_GC_LOSSY = 0x64, /* Group chat lossy packet ID */
/* See: `docs/Prevent_Tracking.txt` and `onion.{c,h}` */
NET_PACKET_ONION_SEND_INITIAL = 0x8f,
NET_PACKET_ONION_SEND_1 = 0x90,
NET_PACKET_ONION_SEND_2 = 0x91,
NET_PACKET_ANNOUNCE_REQUEST = 0x92,
NET_PACKET_ANNOUNCE_RESPONSE = 0x93,
NET_PACKET_ONION_DATA_REQUEST = 0x94,
NET_PACKET_ONION_DATA_RESPONSE = 0x95,
NET_PACKET_ANNOUNCE_REQUEST_OLD = 0x96, /* TODO: DEPRECATE */
NET_PACKET_ANNOUNCE_RESPONSE_OLD = 0x97, /* TODO: DEPRECATE */
NET_PACKET_ONION_RECV_3 = 0x9b,
NET_PACKET_ONION_RECV_2 = 0x9c,
NET_PACKET_ONION_RECV_1 = 0x9d,
NET_PACKET_FORWARD_REQUEST = 0x9e,
NET_PACKET_FORWARDING = 0x9f,
NET_PACKET_FORWARD_REPLY = 0xa0,
NET_PACKET_DATA_SEARCH_REQUEST = 0xa1,
NET_PACKET_DATA_SEARCH_RESPONSE = 0xa2,
NET_PACKET_DATA_RETRIEVE_REQUEST = 0xa3,
NET_PACKET_DATA_RETRIEVE_RESPONSE = 0xa4,
NET_PACKET_STORE_ANNOUNCE_REQUEST = 0xa5,
NET_PACKET_STORE_ANNOUNCE_RESPONSE = 0xa6,
BOOTSTRAP_INFO_PACKET_ID = 0xf1, /* Only used for bootstrap nodes */
NET_PACKET_MAX = 0xff, /* This type must remain within a single uint8. */
} Net_Packet_Type;
#else
typedef enum Net_Packet_Type {
NET_PACKET_PING_REQUEST = 0x00, /* Ping request packet ID. */
NET_PACKET_PING_RESPONSE = 0x01, /* Ping response packet ID. */
@ -195,7 +145,6 @@ typedef enum Net_Packet_Type {
NET_PACKET_MAX = 0xff, /* This type must remain within a single uint8. */
} Net_Packet_Type;
#endif // test network
#define TOX_PORTRANGE_FROM 33445