gdr / tuntox (public) (License: GPLv3) (since 2017-01-24) (hash sha1)
Tunnel TCP connections over the Tox protocol
List of commits:
Subject Hash Author Date (UTC)
Fix tabs/spaces in main.c 0ba3dc62293ece11400673965b89a99d91d7e8ed GDR! 2022-06-12 11:42:29
Print --help to stdout instead of stderr ed9ce9cf470560562346445e5bc937701b0ac0ec GDR! 2022-06-12 11:41:20
Fix bitbucket deb build that was missing gitversion 0b01538c9bc8b1620385346dbc04bc8d4f06497b GDR! 2022-06-12 11:35:19
Update debian to 0.0.10.1 c1070d542c259b6c8c791d46365d19256d8e94e1 GDR! 2022-06-12 11:24:58
add LIB_DIR variable with default that can be overrided 4eda1442c458506158257341ab6d3fd4543288cc Arte Ebrahimi 2022-06-10 23:38:53
Fix deps on macOS makefile 365d2e5cbc0e3655fb64c204db0515f5f4cdf5a4 Will Cohen 2022-02-18 01:26:37
Fix mach on macOS e5a4f6aa23be2f6f4a419b8d65b36ec6e636991e Will Cohen 2022-02-18 01:23:59
Support IPv6 bootstrap nodes a646402f42e120c7148d4de29dbdf5b09027a80a GDR! 2021-12-24 10:37:23
Clean up merged code for JSON bootstrap nodes 7d45afdf7d00a95a8c3687175e2b1669fa1f7745 GDR! 2021-12-24 10:08:50
Added option to bootstrap from json file. 8a409731543aa2cdcba5035091e4f219d8603a76 Pietro Bonfa 2021-12-24 09:20:19
Add a break statement to silence Coverity 1e5c86a2b997f43117adbc18f8b1c16fed4c6eab GDR! 2021-12-10 10:33:02
Clean up indentation 0dc0012b699584828648ad5597ee17b77e275983 GDR! 2021-12-10 10:32:12
0.0.10 5923903d6e48e7990172f0d54394fa2bbc69ca9e GDR! 2021-12-07 08:58:46
Change docker-compose image address 18b0864c66767ed1f300f1f0ec2a2569b749c628 GDR! 2021-04-27 10:42:59
New docker image address at dockerhub 2e9e79947ecb9b62add1ff957d6b71a448d1d87b GDR! 2020-08-15 18:00:18
Add missing dockerfile d91e8ea5765bacfe3072d709d8c552d7f59f18d1 GDR! 2020-08-15 17:42:53
Perform a complete build inside Docker 92312438844988e45da6b1804cdb19ca7beef7bd GDR! 2020-08-15 17:19:52
Fix gcc warnings about strncpy a0fb587f1be623423db9d1e9882341731fab8ec5 GDR! 2020-08-15 16:50:44
Fix travis 07fd5cd5506b65afbd15c7289a341cb27da71114 GDR! 2020-08-15 16:36:25
Use py3 in travis c5e965f824faaa1a95647c469d0d8e4add17b3cd GDR! 2020-08-15 16:29:57
Commit 0ba3dc62293ece11400673965b89a99d91d7e8ed - Fix tabs/spaces in main.c
Author: GDR!
Author date (UTC): 2022-06-12 11:42
Committer name: GDR!
Committer date (UTC): 2022-06-12 11:42
Parent(s): ed9ce9cf470560562346445e5bc937701b0ac0ec
Signer:
Signing key: 557FAEF4E8799852
Signing status: E
Tree: c3cd801c0b4b04f7501607d4c23a09a8223a360f
File Lines added Lines deleted
main.c 72 72
File main.c changed (mode: 100644) (index ff57619..659efa7)
... ... void cleanup()
931 931 tox_kill(tox); tox_kill(tox);
932 932 if(client_socket) if(client_socket)
933 933 { {
934 close(client_socket);
934 close(client_socket);
935 935 } }
936 936 log_close(); log_close();
937 937 } }
 
... ... void help()
1245 1245 fprintf(stdout, " mode\n"); fprintf(stdout, " mode\n");
1246 1246 fprintf(stdout, " -s <secret> - shared secret used for connection authentication (max\n"); fprintf(stdout, " -s <secret> - shared secret used for connection authentication (max\n");
1247 1247 fprintf(stdout, " %u characters)\n", TOX_MAX_FRIEND_REQUEST_LENGTH-1); fprintf(stdout, " %u characters)\n", TOX_MAX_FRIEND_REQUEST_LENGTH-1);
1248 fprintf(stdout, " -t <port> - set TCP relay port (0 disables TCP relaying)\n");
1249 fprintf(stdout, " -u <port>:<port> - set Tox UDP port range\n");
1248 fprintf(stdout, " -t <port> - set TCP relay port (0 disables TCP relaying)\n");
1249 fprintf(stdout, " -u <port>:<port> - set Tox UDP port range\n");
1250 1250 fprintf(stdout, " -d - debug mode (use twice to display toxcore log too)\n"); fprintf(stdout, " -d - debug mode (use twice to display toxcore log too)\n");
1251 1251 fprintf(stdout, " -q - quiet mode\n"); fprintf(stdout, " -q - quiet mode\n");
1252 1252 fprintf(stdout, " -S - send output to syslog instead of stdout\n"); fprintf(stdout, " -S - send output to syslog instead of stdout\n");
 
... ... int main(int argc, char *argv[])
1267 1267 size_t save_size = 0; size_t save_size = 0;
1268 1268 uint8_t *save_data = NULL; uint8_t *save_data = NULL;
1269 1269 allowed_toxid *allowed_toxid_obj = NULL; allowed_toxid *allowed_toxid_obj = NULL;
1270
1271 srand(time(NULL));
1272 tcp_relay_port = 1024 + (rand() % 64511);
1273 udp_start_port = 1024 + (rand() % 64500);
1274 udp_end_port = udp_start_port + 10;
1270
1271 srand(time(NULL));
1272 tcp_relay_port = 1024 + (rand() % 64511);
1273 udp_start_port = 1024 + (rand() % 64500);
1274 udp_end_port = udp_start_port + 10;
1275 1275
1276 1276 log_init(); log_init();
1277 1277
 
... ... int main(int argc, char *argv[])
1360 1360 strncpy(shared_secret, optarg, TOX_MAX_FRIEND_REQUEST_LENGTH-1); strncpy(shared_secret, optarg, TOX_MAX_FRIEND_REQUEST_LENGTH-1);
1361 1361 break; break;
1362 1362 case 'd': case 'd':
1363 if(min_log_level == L_DEBUG2)
1364 {
1365 log_tox_trace = 1;
1366 }
1367 if(min_log_level != L_DEBUG && min_log_level != L_DEBUG2)
1368 {
1369 min_log_level = L_DEBUG;
1370 }
1371 else
1372 {
1373 min_log_level = L_DEBUG2;
1374 }
1363 if(min_log_level == L_DEBUG2)
1364 {
1365 log_tox_trace = 1;
1366 }
1367 if(min_log_level != L_DEBUG && min_log_level != L_DEBUG2)
1368 {
1369 min_log_level = L_DEBUG;
1370 }
1371 else
1372 {
1373 min_log_level = L_DEBUG2;
1374 }
1375 1375
1376 1376 break; break;
1377 1377 case 'q': case 'q':
 
... ... int main(int argc, char *argv[])
1390 1390 case 'U': case 'U':
1391 1391 daemon_username = optarg; daemon_username = optarg;
1392 1392 break; break;
1393 case 't':
1394 errno = 0;
1395 tcp_relay_port = strtol(optarg, NULL, 10);
1396 if(errno != 0 || tcp_relay_port < 0 || tcp_relay_port > 65535)
1397 {
1398 tcp_relay_port = 1024 + (rand() % 64511);
1399 log_printf(L_WARNING, "Ignored -t %s: TCP port number needs to be a number between 0 and 65535.");
1400 }
1401 break;
1402 case 'u':
1403 { /* TODO make a function in util.h */
1404 char *sport;
1405 char *eport;
1406
1407 sport = strtok(optarg, ":");
1408 eport = strtok(NULL, ":");
1409 if(!sport || !eport)
1410 {
1411 log_printf(L_WARNING, "Ignored -u %s: wrong format");
1412 }
1413 else
1414 {
1415 errno = 0;
1416 udp_start_port = strtol(sport, NULL, 10);
1417 udp_end_port = strtol(eport, NULL, 10);
1418 if(errno != 0 || udp_start_port < 1 || udp_start_port > 65535 || \
1419 udp_end_port < 1 || udp_end_port > 65535)
1420 {
1421 log_printf(L_WARNING, "Ignored -u %s: ports need to be integers between 1 and 65535");
1422 udp_start_port = 1024 + (rand() % 64500);
1423 udp_end_port = udp_start_port + 10;
1424 }
1425
1426 }
1427 }
1428 break;
1393 case 't':
1394 errno = 0;
1395 tcp_relay_port = strtol(optarg, NULL, 10);
1396 if(errno != 0 || tcp_relay_port < 0 || tcp_relay_port > 65535)
1397 {
1398 tcp_relay_port = 1024 + (rand() % 64511);
1399 log_printf(L_WARNING, "Ignored -t %s: TCP port number needs to be a number between 0 and 65535.");
1400 }
1401 break;
1402 case 'u':
1403 { /* TODO make a function in util.h */
1404 char *sport;
1405 char *eport;
1406
1407 sport = strtok(optarg, ":");
1408 eport = strtok(NULL, ":");
1409 if(!sport || !eport)
1410 {
1411 log_printf(L_WARNING, "Ignored -u %s: wrong format");
1412 }
1413 else
1414 {
1415 errno = 0;
1416 udp_start_port = strtol(sport, NULL, 10);
1417 udp_end_port = strtol(eport, NULL, 10);
1418 if(errno != 0 || udp_start_port < 1 || udp_start_port > 65535 || \
1419 udp_end_port < 1 || udp_end_port > 65535)
1420 {
1421 log_printf(L_WARNING, "Ignored -u %s: ports need to be integers between 1 and 65535");
1422 udp_start_port = 1024 + (rand() % 64500);
1423 udp_end_port = udp_start_port + 10;
1424 }
1425
1426 }
1427 }
1428 break;
1429 1429 case 'b': case 'b':
1430 1430 strncpy(boot_json, optarg, sizeof(boot_json) - 1); strncpy(boot_json, optarg, sizeof(boot_json) - 1);
1431 1431 break; break;
 
... ... int main(int argc, char *argv[])
1475 1475
1476 1476 /* Bootstrap tox */ /* Bootstrap tox */
1477 1477 tox_options_default(&tox_options); tox_options_default(&tox_options);
1478 if(min_log_level >= L_DEBUG2)
1479 {
1480 tox_options.log_callback = on_tox_log;
1481 }
1482 tox_options.udp_enabled = 1;
1483 tox_options.local_discovery_enabled = 1;
1484 tox_options.tcp_port = tcp_relay_port;
1485 tox_options.start_port = udp_start_port;
1486 tox_options.end_port = udp_end_port;
1487 tox_options.hole_punching_enabled = 1;
1488
1489 log_printf(L_INFO, "Using %d for TCP relay port and %d-%d for UDP",
1490 tox_options.tcp_port,
1491 tox_options.start_port,
1492 tox_options.end_port
1493 );
1478 if(min_log_level >= L_DEBUG2)
1479 {
1480 tox_options.log_callback = on_tox_log;
1481 }
1482 tox_options.udp_enabled = 1;
1483 tox_options.local_discovery_enabled = 1;
1484 tox_options.tcp_port = tcp_relay_port;
1485 tox_options.start_port = udp_start_port;
1486 tox_options.end_port = udp_end_port;
1487 tox_options.hole_punching_enabled = 1;
1488
1489 log_printf(L_INFO, "Using %d for TCP relay port and %d-%d for UDP",
1490 tox_options.tcp_port,
1491 tox_options.start_port,
1492 tox_options.end_port
1493 );
1494 1494
1495 1495 if((!client_mode) || load_saved_toxid_in_client_mode) if((!client_mode) || load_saved_toxid_in_client_mode)
1496 1496 { {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gdr/tuntox

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gdr/tuntox

Clone this repository using git:
git clone git://git.rocketgit.com/user/gdr/tuntox

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main