diff --git a/doc/toxic.1 b/doc/toxic.1 index 242072c..af74931 100644 --- a/doc/toxic.1 +++ b/doc/toxic.1 @@ -2,12 +2,12 @@ .\" Title: toxic .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 2014-12-27 +.\" Date: 2015-03-28 .\" Manual: Toxic Manual .\" Source: toxic __VERSION__ .\" 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 .\" ----------------------------------------------------------------- @@ -111,6 +111,11 @@ Use specified DNSservers file Force TCP connection (use this with proxies) .RE .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 .RS 4 Unencrypt a data file\&. A warning will appear if this option is used with a data file that is already unencrypted\&. diff --git a/doc/toxic.1.asc b/doc/toxic.1.asc index 0ee3c06..4950c6b 100644 --- a/doc/toxic.1.asc +++ b/doc/toxic.1.asc @@ -59,6 +59,9 @@ OPTIONS -t, --force-tcp:: 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:: Unencrypt a data file. A warning will appear if this option is used with a data file that is already unencrypted. diff --git a/doc/toxic.conf.5 b/doc/toxic.conf.5 index c1a6073..ad7066f 100644 --- a/doc/toxic.conf.5 +++ b/doc/toxic.conf.5 @@ -2,12 +2,12 @@ .\" Title: toxic.conf .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 2015-02-26 +.\" Date: 2015-03-28 .\" Manual: Toxic Manual .\" Source: toxic __VERSION__ .\" 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 .\" ----------------------------------------------------------------- diff --git a/src/toxic.c b/src/toxic.c index 9d14328..82acc5a 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -569,10 +569,14 @@ static void init_tox_options(struct Tox_Options *tox_opts) tox_opts->ipv6_enabled = !arg_opts.use_ipv4; tox_opts->udp_enabled = !arg_opts.force_tcp; tox_opts->proxy_type = arg_opts.proxy_type; + tox_opts->tcp_port = arg_opts.tcp_port; if (!tox_opts->ipv6_enabled) 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) { tox_opts->proxy_port = arg_opts.proxy_port; 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, --HTTP-proxy Use HTTP proxy: Requires [IP] [port]\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"); } @@ -888,13 +893,14 @@ static void parse_args(int argc, char *argv[]) {"noconnect", no_argument, 0, 'o'}, {"dnslist", required_argument, 0, 'r'}, {"force-tcp", no_argument, 0, 't'}, + {"tcp-server", required_argument, 0, 'T'}, {"SOCKS5-proxy", required_argument, 0, 'p'}, {"HTTP-proxy", required_argument, 0, 'P'}, {"unencrypt-data", no_argument, 0, 'u'}, {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; 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; break; + case 'T': + arg_opts.tcp_port = (uint16_t) atoi(optarg); + break; + case 'u': arg_opts.unencrypt_data = 1; break; diff --git a/src/windows.h b/src/windows.h index a3c9e8d..21e90bf 100644 --- a/src/windows.h +++ b/src/windows.h @@ -97,6 +97,8 @@ struct arg_opts { char proxy_address[256]; uint8_t proxy_type; uint16_t proxy_port; + + uint16_t tcp_port; }; typedef struct ToxWindow ToxWindow;