rate limit socks 5 connections

This commit is contained in:
Quentin 2020-02-01 22:14:34 +01:00
parent f94427ecca
commit 187266426a

View file

@ -151,14 +151,16 @@ void donar_client(struct donar_client_ctx* ctx, struct donar_params* dp) {
load_onion_services (ctx, dp->onion_file, dp->links);
printf("--- Onion services loaded\n");
for (int i = 0; i < dp->links; i++) {
init_socks5_client(ctx, i);
}
printf("--- TCP Clients Connected\n");
init_timer(&ctx->evts);
printf("--- Inited Timer\n");
for (int64_t i = 0; i < dp->links; i++) {
int64_t to_wait_sec = 10 + i * 3;
fprintf(stdout, "[%s][donar-client] Triggering socks5 in %ld seconds for port %d\n", current_human_datetime (), to_wait_sec, i+7500);
set_timeout(&ctx->evts, 1000 * to_wait_sec, (void*) i, reinit_socks5);
}
printf("--- TCP Clients Connected\n");
g_ptr_array_foreach (dp->remote_ports, (void(*)(void*, void*))init_udp_remote, &(ctx->evts));
printf("--- Remote ports are binded locally\n");