Skip to content

Commit

Permalink
Add option to disable LAN
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Aug 11, 2020
1 parent f012007 commit 47fecc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/toxic.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ static void init_tox_options(struct Tox_Options *tox_opts)
tox_options_set_udp_enabled(tox_opts, !arg_opts.force_tcp);
tox_options_set_proxy_type(tox_opts, arg_opts.proxy_type);
tox_options_set_tcp_port(tox_opts, arg_opts.tcp_port);
tox_options_set_local_discovery_enabled(tox_opts, !arg_opts.disable_local_discovery);

if (arg_opts.logging) {
tox_options_set_log_callback(tox_opts, cb_toxcore_logger);
Expand Down Expand Up @@ -974,6 +975,7 @@ static void print_usage(void)
fprintf(stderr, " -f, --file Use specified data file\n");
fprintf(stderr, " -h, --help Show this message and exit\n");
fprintf(stderr, " -l, --logging Enable toxcore logging: Requires [log_path | stderr]\n");
fprintf(stderr, " -L, --no-lan Disable local discovery\n");
fprintf(stderr, " -n, --nodes Use specified DHTnodes file\n");
fprintf(stderr, " -o, --noconnect Do not connect to the DHT network\n");
fprintf(stderr, " -p, --SOCKS5-proxy Use SOCKS5 proxy: Requires [IP] [port]\n");
Expand Down Expand Up @@ -1011,6 +1013,7 @@ static void parse_args(int argc, char *argv[])
{"config", required_argument, 0, 'c'},
{"encrypt-data", no_argument, 0, 'e'},
{"logging", required_argument, 0, 'l'},
{"no-lan", no_argument, 0, 'L'},
{"nodes", required_argument, 0, 'n'},
{"help", no_argument, 0, 'h'},
{"noconnect", no_argument, 0, 'o'},
Expand All @@ -1024,7 +1027,7 @@ static void parse_args(int argc, char *argv[])
{NULL, no_argument, NULL, 0},
};

const char *opts_str = "4bdehotuxvc:f:l:n:r:p:P:T:";
const char *opts_str = "4bdehLotuxvc:f:l:n:r:p:P:T:";
int opt, indexptr;
long int port = 0;

Expand Down Expand Up @@ -1109,6 +1112,11 @@ static void parse_args(int argc, char *argv[])

break;

case 'L':
arg_opts.disable_local_discovery = 1;
queue_init_message("Local discovery disabled");
break;

case 'n':
snprintf(arg_opts.nodes_path, sizeof(arg_opts.nodes_path), "%s", optarg);
break;
Expand Down
1 change: 1 addition & 0 deletions src/windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct av_thread {
struct arg_opts {
bool use_ipv4;
bool force_tcp;
bool disable_local_discovery;
bool debug;
bool default_locale;
bool use_custom_data;
Expand Down

0 comments on commit 47fecc3

Please sign in to comment.