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)
Added handle_server_tcp_fin_frame 169a478762d6863782395acff8c9f53b733048f5 GDR! 2014-12-11 21:19:32
Added systemd and supervisord config files ea3d59d854108f28c2d2d10a5af60fe3d66e1f6f GDR! 2014-12-11 20:33:54
Removed the const qualifier from frame->data d81429c916e41958483256556dea861cb97487c4 GDR! 2014-12-11 19:57:32
Updated the IP of MVPS bootstrap node fbe7d5d1b54b0c67d644ad68ca37088f529d150f GDR! 2014-12-11 19:56:04
Got rid of some dead code a60a3712c46bcef7dbb9c56c84693d070230c91b GDR! 2014-12-11 19:47:19
Make localhost work even if regular name resolution fails eee06b7d149e00a79897c1d17b0264af99e5149e GDR! 2014-12-11 19:38:38
Readme tweaks 6bb15840b0bde8e5949e76873aec418f2b64951f GDR! 2014-12-11 18:41:19
License 0974ae043fe15596554512560f72a0a08863e282 GDR! 2014-12-11 18:37:29
mention build.md 13f31613c0a89007baef47d8e4d5d1e47c4d4ff9 GDR! 2014-12-11 18:32:25
Help on -C switch ab22ba6bcbc395527950fcb9743080c651ab5ef8 GDR! 2014-12-11 18:31:13
Bare bones documentation aada851bb2c5576ba9afb1a486ea4b01e0c05ac3 GDR! 2014-12-11 18:30:14
Initial commit 4c36e3b71adab6e9f3f08fda3b5c7bf5714ef201 GDR! 2014-12-11 13:27:41
Server state loading/saving 7cb0f811c9a573342ec390080ac67e640d0f2e30 GDR! 2014-11-26 12:55:12
Multi-connection support client-side. 16add85eb81629b07dd7bdb04fbe30be1410cc83 GDR! 2014-11-25 22:09:45
TCP works, yay c311fb3bdd2c26c347c2dd734f97003ac0538037 GDR! 2014-11-16 02:54:56
creating tunnels half-made 9b523f2b826dea54613f2eac78f754c9772841b6 GDR! 2014-11-15 19:14:53
builds well 3b42ed1ca1be6d1c8f14606befee8b8deae64ac8 GDR! 2014-11-10 18:05:14
makefile f877c04fdb45aebff081df4ed1b7fea9bd293fa5 GDR! 2014-11-09 16:24:12
Commit 169a478762d6863782395acff8c9f53b733048f5 - Added handle_server_tcp_fin_frame
Author: GDR!
Author date (UTC): 2014-12-11 21:19
Committer name: GDR!
Committer date (UTC): 2014-12-11 21:19
Parent(s): ea3d59d854108f28c2d2d10a5af60fe3d66e1f6f
Signer:
Signing key:
Signing status: N
Tree: 81bee083ffd6e7fa2dcfc49b06f960802c2b3ef8
File Lines added Lines deleted
client.c 24 0
client.h 1 0
main.c 8 6
scripts/tuntox.service 2 0
File client.c changed (mode: 100644) (index 75d4b0d..58b35d4)
... ... int handle_server_tcp_frame(protocol_frame *rcvd_frame)
171 171 return 0; return 0;
172 172 } }
173 173
174 /* Handle close-tunnel frame recived from the server */
175 int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
176 {
177 tunnel *tun=NULL;
178 int offset = 0;
179 int connid = rcvd_frame->connid;
180
181 HASH_FIND_INT(by_id, &connid, tun);
182
183 if(!tun)
184 {
185 fprintf(stderr, "Got TCP FIN frame with unknown tunnel ID %d\n", rcvd_frame->connid);
186 return -1;
187 }
188
189 if(tun->friendnumber != rcvd_frame->friendnumber)
190 {
191 fprintf(stderr, "Friend #%d tried to close tunnel while server is #%d\n", rcvd_frame->friendnumber, tun->friendnumber);
192 return -1;
193 }
194
195 tunnel_delete(tun);
196 }
197
174 198 /* Main loop for the client */ /* Main loop for the client */
175 199 int do_client_loop(char *tox_id_str) int do_client_loop(char *tox_id_str)
176 200 { {
File client.h changed (mode: 100644) (index 7d5e50d..d22c161)
16 16 int handle_pong_frame(protocol_frame *rcvd_frame); int handle_pong_frame(protocol_frame *rcvd_frame);
17 17 int handle_acktunnel_frame(protocol_frame *rcvd_frame); int handle_acktunnel_frame(protocol_frame *rcvd_frame);
18 18 int handle_server_tcp_frame(protocol_frame *rcvd_frame); int handle_server_tcp_frame(protocol_frame *rcvd_frame);
19 int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame);
19 20 int do_client_loop(char *tox_id_str); int do_client_loop(char *tox_id_str);
File main.c changed (mode: 100644) (index bff4620..f564664)
... ... int handle_client_tcp_frame(protocol_frame *rcvd_frame)
374 374 return -1; return -1;
375 375 } }
376 376
377 if(tun->friendnumber != rcvd_frame->friendnumber)
378 {
379 fprintf(stderr, "Friend #%d tried to send packet to a tunnel which belongs to #%d\n", rcvd_frame->friendnumber, tun->friendnumber);
380 return -1;
381 }
382
377 383 while(offset < rcvd_frame->data_length) while(offset < rcvd_frame->data_length)
378 384 { {
379 385 int sent_bytes; int sent_bytes;
 
... ... int handle_client_tcp_frame(protocol_frame *rcvd_frame)
397 403 return 0; return 0;
398 404 } }
399 405
400 int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
401 {
402
403 }
404
405 406 /* Handle close-tunnel frame received from the client */ /* Handle close-tunnel frame received from the client */
406 407 int handle_client_tcp_fin_frame(protocol_frame *rcvd_frame) int handle_client_tcp_fin_frame(protocol_frame *rcvd_frame)
407 408 { {
 
... ... int parse_lossless_packet(void *sender_uc, const uint8_t *data, uint32_t len)
506 507 frame->packet_type = INT16_AT(data, 2); frame->packet_type = INT16_AT(data, 2);
507 508 frame->connid = INT16_AT(data, 4); frame->connid = INT16_AT(data, 4);
508 509 frame->data_length = INT16_AT(data, 6); frame->data_length = INT16_AT(data, 6);
509 frame->data = data + PROTOCOL_BUFFER_OFFSET;
510 frame->data = (uint8_t *)(data + PROTOCOL_BUFFER_OFFSET);
510 511 frame->friendnumber = *((uint32_t*)sender_uc); frame->friendnumber = *((uint32_t*)sender_uc);
511 512 printf("Got protocol frame magic 0x%x type 0x%x from friend %d\n", frame->magic, frame->packet_type, frame->friendnumber); printf("Got protocol frame magic 0x%x type 0x%x from friend %d\n", frame->magic, frame->packet_type, frame->friendnumber);
512 513
 
... ... int main(int argc, char *argv[])
861 862 } }
862 863
863 864 tox_get_address(tox, tox_id); tox_get_address(tox, tox_id);
865 memset(tox_printable_id, '\0', sizeof(tox_printable_id));
864 866 id_to_string(tox_printable_id, tox_id); id_to_string(tox_printable_id, tox_id);
865 867 tox_printable_id[TOX_FRIEND_ADDRESS_SIZE * 2] = '\0'; tox_printable_id[TOX_FRIEND_ADDRESS_SIZE * 2] = '\0';
866 868 printf("Using Tox ID: %s\n", tox_printable_id); printf("Using Tox ID: %s\n", tox_printable_id);
File scripts/tuntox.service changed (mode: 100644) (index e4fc3d3..862a539)
1 # Systemd service file
2
1 3 [Unit] [Unit]
2 4 Description=Tuntox - TCP tunnel over Tox protocol Description=Tuntox - TCP tunnel over Tox protocol
3 5 After=network.target After=network.target
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