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)
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
FreeBSD build instructions d20567154fb91de3a73baac9361d3ae99984e55c GDR! 2020-08-15 14:44:23
FAQ - links to packages 8691dbe266c51f788f763e0af3c712f3bab97f6f GDR! 2020-08-15 14:01:38
Try to name the deb appropiately 9e834d9af82f5819a59313c0b2276ba0dc2b0477 GDR! 2020-08-15 08:11:32
Lets try creating .tar.gz without dh_make 5d4dee4428e17f76b3b4a8ca769fad8695d8f02d GDR! 2020-08-15 08:04:57
Prevent dh_make warnings from stopping the build ca6a8b1f62e307c0430856619fc2b7797a71ec94 GDR! 2020-08-15 08:00:28
-y for dh_make 194a2bb10b581765d0a2a4c3e78965d4ad0e40df GDR! 2020-08-15 07:57:58
fix dh_make 7ae361ddb1d5d9e310c196e37c9e50e907c7d79c GDR! 2020-08-15 07:54:45
ci 5d7cfcb28e5b477e366dda746b40a99df4a7604f GDR! 2020-08-15 07:45:39
Commit 7d45afdf7d00a95a8c3687175e2b1669fa1f7745 - Clean up merged code for JSON bootstrap nodes
Author: GDR!
Author date (UTC): 2021-12-24 10:08
Committer name: GDR!
Committer date (UTC): 2021-12-24 10:11
Parent(s): f6efcab78be01b96cab761b015110e1feb154ea2
Signer:
Signing key: 557FAEF4E8799852
Signing status: E
Tree: 02abf1fb317005f4daca269fa369adeaf9184d58
File Lines added Lines deleted
LICENSE.md 22 0
gitversion.h 1 1
main.c 1 0
tox_bootstrap_json.c 4 34
util.c 31 0
util.h 2 0
File LICENSE.md changed (mode: 100644) (index 2061be2..a748cbe)
... ... it more useful to permit linking proprietary applications with the library. If
654 654 this is what you want to do, use the GNU Lesser General Public License instead this is what you want to do, use the GNU Lesser General Public License instead
655 655 of this License. But first, please read of this License. But first, please read
656 656 <<http://www.gnu.org/philosophy/why-not-lgpl.html>>. <<http://www.gnu.org/philosophy/why-not-lgpl.html>>.
657
658 This software uses cJson by DaveGamble.
659
660 Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
661
662 Permission is hereby granted, free of charge, to any person obtaining a copy
663 of this software and associated documentation files (the "Software"), to deal
664 in the Software without restriction, including without limitation the rights
665 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
666 copies of the Software, and to permit persons to whom the Software is
667 furnished to do so, subject to the following conditions:
668
669 The above copyright notice and this permission notice shall be included in
670 all copies or substantial portions of the Software.
671
672 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
673 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
674 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
675 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
676 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
677 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
678 THE SOFTWARE.
File gitversion.h changed (mode: 100644) (index 3bf0048..ba81d9d)
1 #define GITVERSION "18b0864c66767ed1f300f1f0ec2a2569b749c628"
1 #define GITVERSION "f6efcab78be01b96cab761b015110e1feb154ea2"
File main.c changed (mode: 100644) (index 48e7875..e0d9066)
... ... void help()
1254 1254 fprintf(stderr, " -F <path> - create a PID file named <path>\n"); fprintf(stderr, " -F <path> - create a PID file named <path>\n");
1255 1255 fprintf(stderr, " -U <username|userid> - drop privileges to <username> before forking. Use\n"); fprintf(stderr, " -U <username|userid> - drop privileges to <username> before forking. Use\n");
1256 1256 fprintf(stderr, " numeric <userid> in static builds.\n"); fprintf(stderr, " numeric <userid> in static builds.\n");
1257 fprintf(stderr, " -b <path> - bootstrap from Tox nodes in a JSON file like nodes.tox.chat/json\n");
1257 1258 fprintf(stderr, " -h - this help message\n"); fprintf(stderr, " -h - this help message\n");
1258 1259 } }
1259 1260
File tox_bootstrap_json.c changed (mode: 100644) (index 0eecb00..61e9f69)
6 6
7 7 #include "cJSON.h" #include "cJSON.h"
8 8 #include "log.h" #include "log.h"
9 #include "util.h"
9 10
10 /* From https://github.com/TokTok/c-toxcore/blob/master/other/fun/cracker.c */
11 static size_t hex_string_to_bin(const char *hex_string, size_t hex_len, uint8_t *bytes)
11 void do_bootstrap_file(Tox *tox, const char *json_file)
12 12 { {
13 size_t i;
14 const char *pos = hex_string;
15 // make even
16 for (i = 0; i < hex_len / 2; ++i, pos += 2) {
17 uint8_t val;
18 if (sscanf(pos, "%02hhx", &val) != 1) {
19 return 0;
20 }
21 bytes[i] = val;
22 }
23 if (i * 2 < hex_len) {
24 uint8_t val;
25 if (sscanf(pos, "%hhx", &val) != 1) {
26 return 0;
27 }
28 bytes[i] = (uint8_t)(val << 4);
29 ++i;
30 }
31 return i;
32 }
33
34 /* Very stupid test to filter out hostnames */
35 static bool isValidIPv4(const char *ip_address)
36 {
37 unsigned int a,b,c,d;
38 return sscanf(ip_address,"%u.%u.%u.%u", &a, &b, &c, &d) == 4;
39 }
40
41 void do_bootstrap_file(Tox *tox, const char * json_file)
42 {
43 char * buffer = NULL;
13 char *buffer = NULL;
44 14 long length; long length;
45 15
46 16 const cJSON *node = NULL; const cJSON *node = NULL;
 
... ... void do_bootstrap_file(Tox *tox, const char * json_file)
49 19 const cJSON *tcp_port = NULL; const cJSON *tcp_port = NULL;
50 20 unsigned char key_bin[TOX_PUBLIC_KEY_SIZE]; unsigned char key_bin[TOX_PUBLIC_KEY_SIZE];
51 21
52 FILE * f = fopen (json_file, "rb");
22 FILE * f = fopen(json_file, "rb");
53 23
54 24 if (f) { if (f) {
55 25 fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
File util.c changed (mode: 100644) (index 3e6a99c..5299415)
... ... const char *readable_connection_status(TOX_CONNECTION status)
202 202 return "Unknown connection status"; return "Unknown connection status";
203 203 } }
204 204 } }
205
206 /* From https://github.com/TokTok/c-toxcore/blob/master/other/fun/cracker.c */
207 size_t hex_string_to_bin(const char *hex_string, size_t hex_len, uint8_t *bytes)
208 {
209 size_t i;
210 const char *pos = hex_string;
211 // make even
212 for (i = 0; i < hex_len / 2; ++i, pos += 2) {
213 uint8_t val;
214 if (sscanf(pos, "%02hhx", &val) != 1) {
215 return 0;
216 }
217 bytes[i] = val;
218 }
219 if (i * 2 < hex_len) {
220 uint8_t val;
221 if (sscanf(pos, "%hhx", &val) != 1) {
222 return 0;
223 }
224 bytes[i] = (uint8_t)(val << 4);
225 ++i;
226 }
227 return i;
228 }
229
230 /* Very stupid test to filter out hostnames */
231 bool isValidIPv4(const char *ip_address)
232 {
233 unsigned int a,b,c,d;
234 return sscanf(ip_address,"%u.%u.%u.%u", &a, &b, &c, &d) == 4;
235 }
File util.h changed (mode: 100644) (index 7dced6b..1d3b339)
... ... void* file_raw(char *path, uint32_t *size);
15 15 const char *readable_connection_status(TOX_CONNECTION status); const char *readable_connection_status(TOX_CONNECTION status);
16 16 int parse_local_port_forward(char *string, int *local_port, char **hostname, int *remote_port); int parse_local_port_forward(char *string, int *local_port, char **hostname, int *remote_port);
17 17 int parse_pipe_port_forward(char *string, char **hostname, int *remote_port); int parse_pipe_port_forward(char *string, char **hostname, int *remote_port);
18 size_t hex_string_to_bin(const char *hex_string, size_t hex_len, uint8_t *bytes);
19 bool isValidIPv4(const char *ip_address);
18 20
19 21 #endif #endif
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