35 lines
1 KiB
C
35 lines
1 KiB
C
#include "donar_client.h"
|
|
|
|
void load_onion_services(struct donar_client_ctx* ctx, char* onion_file, int ports_count) {
|
|
tor_os_create (&(ctx->tos), onion_file, NULL, ports_count);
|
|
tor_os_read (&(ctx->tos));
|
|
}
|
|
|
|
void init_tcp_clients(struct donar_client_ctx* ctx) {
|
|
|
|
}
|
|
|
|
void donar_client(struct donar_client_ctx* ctx, struct algo_skel* algo, char* onion_file, char* port) {
|
|
evt_core_init (&(ctx->evts));
|
|
evt_core_add_cat (&(ctx->evts), &(algo->on_tcp_co));
|
|
evt_core_add_cat (&(ctx->evts), &(algo->on_udp_read));
|
|
evt_core_add_cat (&(ctx->evts), &(algo->on_tcp_read));
|
|
evt_core_add_cat (&(ctx->evts), &(algo->on_udp_write));
|
|
evt_core_add_cat (&(ctx->evts), &(algo->on_tcp_write));
|
|
printf("--- Categories created\n");
|
|
|
|
load_onion_services (ctx, onion_file, CLIENT_PORT_SIZE);
|
|
printf("--- Onion services loaded\n");
|
|
|
|
for (int i = 0; i < ctx->tos.filled; i++) {
|
|
printf("onion service: %s\n",ctx->tos.keys[i].pub);
|
|
}
|
|
|
|
for (uint16_t i = 0; i < CLIENT_PORT_SIZE ; i++) {
|
|
ctx->ports[i] = 7500 + i;
|
|
}
|
|
|
|
init_tcp_clients(ctx);
|
|
|
|
}
|