ratox

FIFO based tox client
Log | Files | Refs | README | LICENSE

commit a5a18a2b84f29595a85bca039df184a454443093
parent ea8e549499a682ec96444a98de3c86fda8a0e7f8
Author: pranomostro <pranomostro@posteo.net>
Date:   Sat Jun  3 19:58:18 +0200

Add connecting to tcp relays by default.

I'm currently staying in India, and strangely enough ratox
could not connect using tox_bootstrap(). It would just
continue attempting to connect until the end of time.
Using tox_add_tcp_relay() additionally fixes this isssue.
It is also the strategy utox uses:
https://github.com/uTox/uTox/blob/49bc764d23a02ab8286ef6f2085e8e592bccde1e/src/tox.c#L137
Also, nodes.h needed to be regenerated for using
tcp ports and relays.

Diffstat:
nodegen | 7+++++--
nodes.h | 166++++++++++++++++++++++++++++++++++++++++---------------------------------------
ratox.c | 9+++++++--
3 files changed, 97 insertions(+), 85 deletions(-)
diff --git a/nodegen b/nodegen @@ -3,7 +3,10 @@ echo 'static struct node nodes[] = {' curl -s https://nodes.tox.chat/json | -jq --tab '[.nodes[] | select(.last_ping > 0) | {".addr4": .ipv4, ".addr6": .ipv6, ".port": .port, ".idstr": .public_key}]' | -sed 's/"-"/NULL/; s/"\(\.[0-9a-z]\+\)":/\1 =/; 1d; $d' +jq --tab '[.nodes[] | + select(.last_ping > 0) | + select(.tcp_ports | length > 0) | + {".addr4": .ipv4, ".addr6": .ipv6, ".udp_port": .port, ".tcp_port": .tcp_ports[0], ".idstr": .public_key}]' | +sed 's/"-"/NULL/; s/"\(\.[0-9a-z_]\+\)":/\1 =/; 1d; $d' echo '};' diff --git a/nodes.h b/nodes.h @@ -2,277 +2,281 @@ static struct node nodes[] = { { .addr4 = "biribiri.org", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67" }, { .addr4 = "nodes.tox.chat", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "6FC41E2BD381D37E9748FC0E0328CE086AF9598BECC8FEB7DDF2E440475F300E" }, { .addr4 = "130.133.110.14", .addr6 = "2001:6f8:1c3c:babe::14:1", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F" }, { .addr4 = "205.185.116.116", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "A179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702" }, { .addr4 = "198.98.51.198", .addr6 = "2605:6400:1:fed5:22:45af:ec10:f329", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F" }, { - .addr4 = "108.61.165.198", - .addr6 = "2001:19f0:5000:8121:5054:ff:fe1c:9ded", - .port = 33445, - .idstr = "8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832" - }, - { .addr4 = "194.249.212.109", .addr6 = "2001:1470:fbfe::109", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B" }, { .addr4 = "185.25.116.107", .addr6 = "2a00:7a60:0:746b::3", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43" }, { .addr4 = "5.189.176.217", .addr6 = "2a02:c200:1:10:3:1:605:1337", - .port = 5190, + .udp_port = 5190, + .tcp_port = 33445, .idstr = "2B2137E094F743AC8BD44652C55F41DFACC502F125E99E4FE24D40537489E32F" }, { .addr4 = "217.182.143.254", .addr6 = "2001:41d0:302:1000::e111", - .port = 2306, + .udp_port = 2306, + .tcp_port = 2306, .idstr = "7AED21F94D82B05774F697B209628CD5A9AD17E0C073D9329076A4C28ED28147" }, { .addr4 = "104.223.122.15", .addr6 = "2607:ff48:aa81:800::35eb:1", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "0FB96EEBFB1650DDB52E70CF773DDFCABE25A95CC3BB50FC251082E4B63EF82A" }, { .addr4 = "tox.verdict.gg", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "1C5293AEF2114717547B39DA8EA6F1E331E5E358B35F9B6B5F19317911C5F976" }, { .addr4 = "d4rk4.ru", .addr6 = NULL, - .port = 1813, + .udp_port = 1813, + .tcp_port = 1813, .idstr = "53737F6D47FA6BD2808F378E339AF45BF86F39B64E79D6D491C53A1D522E7039" }, { .addr4 = "104.233.104.126", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "EDEE8F2E839A57820DE3DA4156D88350E53D4161447068A3457EE8F59F362414" }, { .addr4 = "51.254.84.212", .addr6 = "2001:41d0:a:1a3b::18", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "AEC204B9A4501412D5F0BB67D9C81B5DB3EE6ADA64122D32A3E9B093D544327D" }, { .addr4 = "88.99.133.52", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "2D320F971EF2CA18004416C2AAE7BA52BF7949DB34EA8E2E21AF67BD367BE211" }, { .addr4 = "185.58.206.164", .addr6 = "2a02:f680:1:1100::3313", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "24156472041E5F220D1FA11D9DF32F7AD697D59845701CDD7BE7D1785EB9DB39" }, { - .addr4 = "92.54.84.70", - .addr6 = NULL, - .port = 33445, - .idstr = "5625A62618CB4FCA70E147A71B29695F38CC65FF0CBD68AD46254585BE564802" - }, - { .addr4 = "195.93.190.6", .addr6 = "2a01:d0:ffff:a8a::2", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "FB4CE0DDEFEED45F26917053E5D24BDDA0FA0A3D83A672A9DA2375928B37023D" }, { .addr4 = "tox.uplinklabs.net", .addr6 = "tox.uplinklabs.net", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "1A56EA3EDF5DF4C0AEABBF3C2E4E603890F87E983CAC8A0D532A335F2C6E3E1F" }, { .addr4 = "toxnode.nek0.net", .addr6 = "toxnode.nek0.net", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "20965721D32CE50C3E837DD75B33908B33037E6225110BFF209277AEAF3F9639" }, { .addr4 = "95.215.44.78", .addr6 = "2a02:7aa0:1619::c6fe:d0cb", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "672DBE27B4ADB9D5FB105A6BB648B2F8FDB89B3323486A7A21968316E012023C" }, { .addr4 = "163.172.136.118", .addr6 = "2001:bc8:4400:2100::1c:50f", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B" }, { .addr4 = "sorunome.de", .addr6 = "sorunome.de", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "02807CF4F8BB8FB390CC3794BDF1E8449E9A8392C5D3F2200019DA9F1E812E46" }, { .addr4 = "37.97.185.116", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "E59A0E71ADA20D35BD1B0957059D7EF7E7792B3D680AE25C6F4DBBA09114D165" }, { .addr4 = "193.124.186.205", .addr6 = "2a02:f680:1:1100::542a", - .port = 5228, + .udp_port = 5228, + .tcp_port = 3389, .idstr = "9906D65F2A4751068A59D30505C5FC8AE1A95E0843AE9372EAFA3BAB6AC16C2C" }, { .addr4 = "80.87.193.193", .addr6 = "2a01:230:2:6::46a8", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "B38255EE4B054924F6D79A5E6E5889EC94B6ADF6FE9906F97A3D01E3D083223A" }, { .addr4 = "initramfs.io", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "3F0A45A268367C1BEA652F258C85F4A66DA76BCAA667A49E770BCC4917AB6A25" }, { .addr4 = "hibiki.eve.moe", .addr6 = "hibiki.eve.moe", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "D3EB45181B343C2C222A5BCF72B760638E15ED87904625AAD351C594EEFAE03E" }, { .addr4 = "tox.deadteam.org", .addr6 = "tox.deadteam.org", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "C7D284129E83877D63591F14B3F658D77FF9BA9BA7293AEB2BDFBFE1A803AF47" }, { - .addr4 = "46.229.52.198", - .addr6 = NULL, - .port = 33445, - .idstr = "813C8F4187833EF0655B10F7752141A352248462A567529A38B6BBF73E979307" - }, - { .addr4 = "node.tox.ngc.network", .addr6 = "node.tox.ngc.network", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "A856243058D1DE633379508ADCAFCF944E40E1672FF402750EF712E30C42012A" }, { .addr4 = "144.217.86.39", .addr6 = "fe80::f816:3eff:fe61:92e3", - .port = 33445, + .udp_port = 33445, + .tcp_port = 3389, .idstr = "7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C" }, { .addr4 = "185.14.30.213", .addr6 = "2a00:1ca8:a7::e8b", - .port = 443, + .udp_port = 443, + .tcp_port = 3389, .idstr = "2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B" }, { .addr4 = "85.21.144.224", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "8F738BBC8FA9394670BCAB146C67A507B9907C8E564E28C2B59BEBB2FF68711B" }, { .addr4 = "tox.natalenko.name", .addr6 = "tox.natalenko.name", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "1CB6EBFD9D85448FA70D3CAE1220B76BF6FCE911B46ACDCF88054C190589650B" }, { .addr4 = "37.187.122.30", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "BEB71F97ED9C99C04B8489BB75579EB4DC6AB6F441B603D63533122F1858B51D" }, { .addr4 = "completelyunoriginal.moe", .addr6 = "completelyunoriginal.moe", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "FBC7DED0B0B662D81094D91CC312D6CDF12A7B16C7FFB93817143116B510C13E" }, { .addr4 = "136.243.141.187", .addr6 = "2a01:4f8:212:2459::a:1337", - .port = 443, + .udp_port = 443, + .tcp_port = 443, .idstr = "6EE1FADE9F55CC7938234CC07C864081FC606D8FE7B751EDA217F268F1078A39" }, { .addr4 = "tox.abilinski.com", .addr6 = NULL, - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "0E9D7FEE2AA4B42A4C18FE81C038E32FFD8D907AAA7896F05AA76C8D31A20065" }, { .addr4 = "95.215.46.114", .addr6 = "2a02:7aa0:1619::bdbd:17b8", - .port = 33445, + .udp_port = 33445, + .tcp_port = 33445, .idstr = "5823FB947FF24CF83DDFAC3F3BAA18F96EA2018B16CC08429CB97FA502F40C23" }, { - .addr4 = "46.101.197.175", - .addr6 = "2a03:b0c0:3:d0::ac:5001", - .port = 443, - .idstr = "CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707" - }, - { - .addr4 = "77.37.160.178", - .addr6 = NULL, - .port = 33440, - .idstr = "CE678DEAFA29182EFD1B0C5B9BC6999E5A20B50A1A6EC18B91C8EBB591712416" - }, - { - .addr4 = "77.37.142.179", + .addr4 = "78.156.250.2", .addr6 = NULL, - .port = 33445, - .idstr = "98F5830A426C6BF165F895F04B897AFC4F57331B4BE0561F583C9F323194227B" + .udp_port = 33445, + .tcp_port = 443, + .idstr = "88124F3C18C6CFA8778B7679B7329A333616BD27A4DFB562D476681315CF143D" }, { - .addr4 = "plfgr.eu.org", - .addr6 = "plfgr.eu.org", - .port = 33445, - .idstr = "F5A2E533EC720927FA970F508D949D5958F37889F039F50C905010244842656E" - }, - { - .addr4 = "51.15.54.207", - .addr6 = "2001:bc8:4700:2300::28:80d", - .port = 33445, - .idstr = "1E64DBA45EC810C0BF3A96327DC8A9D441AB262C14E57FCE11ECBCE355305239" + .addr4 = "46.101.197.175", + .addr6 = "2a03:b0c0:3:d0::ac:5001", + .udp_port = 443, + .tcp_port = 3389, + .idstr = "CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707" } }; diff --git a/ratox.c b/ratox.c @@ -50,7 +50,8 @@ const char *callerr[] = { struct node { char *addr4; char *addr6; - uint16_t port; + uint16_t udp_port; + uint16_t tcp_port; char *idstr; }; @@ -1465,9 +1466,13 @@ toxconnect(void) if (ipv6 && !n->addr6) continue; str2id(n->idstr, id); - r = tox_bootstrap(tox, ipv6 ? n->addr6 : n->addr4, n->port, id, NULL); + r = tox_bootstrap(tox, ipv6 ? n->addr6 : n->addr4, n->udp_port, id, NULL); if (!r) weprintf("Bootstrap failed for %s\n", ipv6 ? n->addr6 : n->addr4); + str2id(n->idstr, id); + r += tox_add_tcp_relay(tox, ipv6 ? n->addr6 : n->addr4, n->tcp_port, id, NULL); + if (!r) + weprintf("Adding a relay failed for %s\n", ipv6 ? n->addr6 : n->addr4); } return 0; }