1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 21:43:02 +01:00

Add option to enable acting as TCP relay server

This commit is contained in:
Jfreegman 2015-07-08 21:01:32 -04:00 committed by cnhenry
parent 8301ab1bc2
commit 3cb412632b
5 changed files with 26 additions and 6 deletions

View File

@ -2,12 +2,12 @@
.\" Title: toxic .\" Title: toxic
.\" Author: [see the "AUTHORS" section] .\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-12-27 .\" Date: 2015-03-28
.\" Manual: Toxic Manual .\" Manual: Toxic Manual
.\" Source: toxic __VERSION__ .\" Source: toxic __VERSION__
.\" Language: English .\" Language: English
.\" .\"
.TH "TOXIC" "1" "2014\-12\-27" "toxic __VERSION__" "Toxic Manual" .TH "TOXIC" "1" "2015\-03\-28" "toxic __VERSION__" "Toxic Manual"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
@ -111,6 +111,11 @@ Use specified DNSservers file
Force TCP connection (use this with proxies) Force TCP connection (use this with proxies)
.RE .RE
.PP .PP
\-T, \-\-tcp\-relay
.RS 4
Act as a TCP relay server for the network (Note: this uses significantly more bandwidth)
.RE
.PP
\-u, \-\-unencrypt\-data \-u, \-\-unencrypt\-data
.RS 4 .RS 4
Unencrypt a data file\&. A warning will appear if this option is used with a data file that is already unencrypted\&. Unencrypt a data file\&. A warning will appear if this option is used with a data file that is already unencrypted\&.

View File

@ -59,6 +59,9 @@ OPTIONS
-t, --force-tcp:: -t, --force-tcp::
Force TCP connection (use this with proxies) Force TCP connection (use this with proxies)
-T, --tcp-relay::
Act as a TCP relay server for the network (Note: this uses significantly more bandwidth)
-u, --unencrypt-data:: -u, --unencrypt-data::
Unencrypt a data file. A warning will appear if this option is used Unencrypt a data file. A warning will appear if this option is used
with a data file that is already unencrypted. with a data file that is already unencrypted.

View File

@ -2,12 +2,12 @@
.\" Title: toxic.conf .\" Title: toxic.conf
.\" Author: [see the "AUTHORS" section] .\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2015-02-26 .\" Date: 2015-03-28
.\" Manual: Toxic Manual .\" Manual: Toxic Manual
.\" Source: toxic __VERSION__ .\" Source: toxic __VERSION__
.\" Language: English .\" Language: English
.\" .\"
.TH "TOXIC\&.CONF" "5" "2015\-02\-26" "toxic __VERSION__" "Toxic Manual" .TH "TOXIC\&.CONF" "5" "2015\-03\-28" "toxic __VERSION__" "Toxic Manual"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------

View File

@ -569,10 +569,14 @@ static void init_tox_options(struct Tox_Options *tox_opts)
tox_opts->ipv6_enabled = !arg_opts.use_ipv4; tox_opts->ipv6_enabled = !arg_opts.use_ipv4;
tox_opts->udp_enabled = !arg_opts.force_tcp; tox_opts->udp_enabled = !arg_opts.force_tcp;
tox_opts->proxy_type = arg_opts.proxy_type; tox_opts->proxy_type = arg_opts.proxy_type;
tox_opts->tcp_port = arg_opts.tcp_port;
if (!tox_opts->ipv6_enabled) if (!tox_opts->ipv6_enabled)
queue_init_message("Forcing IPv4 connection"); queue_init_message("Forcing IPv4 connection");
if (tox_opts->tcp_port)
queue_init_message("TCP relaying enabled on port %d", tox_opts->tcp_port);
if (tox_opts->proxy_type != TOX_PROXY_TYPE_NONE) { if (tox_opts->proxy_type != TOX_PROXY_TYPE_NONE) {
tox_opts->proxy_port = arg_opts.proxy_port; tox_opts->proxy_port = arg_opts.proxy_port;
tox_opts->proxy_host = arg_opts.proxy_address; tox_opts->proxy_host = arg_opts.proxy_address;
@ -860,7 +864,8 @@ static void print_usage(void)
fprintf(stderr, " -p, --SOCKS5-proxy Use SOCKS5 proxy: Requires [IP] [port]\n"); fprintf(stderr, " -p, --SOCKS5-proxy Use SOCKS5 proxy: Requires [IP] [port]\n");
fprintf(stderr, " -P, --HTTP-proxy Use HTTP proxy: Requires [IP] [port]\n"); fprintf(stderr, " -P, --HTTP-proxy Use HTTP proxy: Requires [IP] [port]\n");
fprintf(stderr, " -r, --dnslist Use specified DNSservers file\n"); fprintf(stderr, " -r, --dnslist Use specified DNSservers file\n");
fprintf(stderr, " -t, --force-tcp Force TCP connection (use this with proxies)\n"); fprintf(stderr, " -t, --force-tcp Force toxic to use a TCP connection (use with proxies)\n");
fprintf(stderr, " -T, --tcp-server Act as a TCP relay server: Requires [port]\n");
fprintf(stderr, " -u, --unencrypt-data Unencrypt an encrypted data file\n"); fprintf(stderr, " -u, --unencrypt-data Unencrypt an encrypted data file\n");
} }
@ -888,13 +893,14 @@ static void parse_args(int argc, char *argv[])
{"noconnect", no_argument, 0, 'o'}, {"noconnect", no_argument, 0, 'o'},
{"dnslist", required_argument, 0, 'r'}, {"dnslist", required_argument, 0, 'r'},
{"force-tcp", no_argument, 0, 't'}, {"force-tcp", no_argument, 0, 't'},
{"tcp-server", required_argument, 0, 'T'},
{"SOCKS5-proxy", required_argument, 0, 'p'}, {"SOCKS5-proxy", required_argument, 0, 'p'},
{"HTTP-proxy", required_argument, 0, 'P'}, {"HTTP-proxy", required_argument, 0, 'P'},
{"unencrypt-data", no_argument, 0, 'u'}, {"unencrypt-data", no_argument, 0, 'u'},
{NULL, no_argument, NULL, 0}, {NULL, no_argument, NULL, 0},
}; };
const char *opts_str = "4bdehotuxc:f:n:r:p:P:"; const char *opts_str = "4bdehotuxc:f:n:r:p:P:T:";
int opt, indexptr; int opt, indexptr;
while ((opt = getopt_long(argc, argv, opts_str, long_opts, &indexptr)) != -1) { while ((opt = getopt_long(argc, argv, opts_str, long_opts, &indexptr)) != -1) {
@ -985,6 +991,10 @@ static void parse_args(int argc, char *argv[])
arg_opts.force_tcp = 1; arg_opts.force_tcp = 1;
break; break;
case 'T':
arg_opts.tcp_port = (uint16_t) atoi(optarg);
break;
case 'u': case 'u':
arg_opts.unencrypt_data = 1; arg_opts.unencrypt_data = 1;
break; break;

View File

@ -97,6 +97,8 @@ struct arg_opts {
char proxy_address[256]; char proxy_address[256];
uint8_t proxy_type; uint8_t proxy_type;
uint16_t proxy_port; uint16_t proxy_port;
uint16_t tcp_port;
}; };
typedef struct ToxWindow ToxWindow; typedef struct ToxWindow ToxWindow;