mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 15:33:03 +01:00
Add option to enable acting as TCP relay server
This commit is contained in:
parent
035420e5c7
commit
904f58c0e8
@ -2,12 +2,12 @@
|
||||
.\" Title: toxic
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" 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\&.
|
||||
|
@ -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.
|
||||
|
@ -2,12 +2,12 @@
|
||||
.\" Title: toxic.conf
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" 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
|
||||
.\" -----------------------------------------------------------------
|
||||
|
14
src/toxic.c
14
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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user