Clean code
This commit is contained in:
parent
fd4cd7034d
commit
670b64e56c
2 changed files with 2 additions and 50 deletions
49
src/donar.c
49
src/donar.c
|
@ -69,53 +69,4 @@ int main(int argc, char** argv) {
|
||||||
free(port);
|
free(port);
|
||||||
free(host);
|
free(host);
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
|
||||||
int sock;
|
|
||||||
|
|
||||||
struct tor_os_str tos;
|
|
||||||
tor_os_create (&tos, "onion_services.pub", "onion_services.txt", 10);
|
|
||||||
tor_os_read (&tos);
|
|
||||||
|
|
||||||
int ports[10] = { 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509};
|
|
||||||
int err = 0;
|
|
||||||
struct tor_ctl tctl = {};
|
|
||||||
err = tor_ctl_connect (&tctl, "127.0.0.1", "9051");
|
|
||||||
if (err < 0) {
|
|
||||||
fprintf(stderr, "Unable to open Tor Socket\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
err = tor_ctl_add_onion (&tctl, &tos, ports);
|
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "Unable to create Onion Services (error: %d)\n", err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
tor_ctl_close (&tctl);
|
|
||||||
tor_os_free (&tos);
|
|
||||||
|
|
||||||
if (argc < 3) {
|
|
||||||
fprintf(stderr, "Insufficient arguments\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
sock = create_tcp_client(argv[1], argv[2]);
|
|
||||||
socks5_handshake(sock);
|
|
||||||
socks5_connect_dns(sock, "monip.org", 80);
|
|
||||||
socks5_reply(sock);
|
|
||||||
|
|
||||||
char* req = "GET / HTTP/1.0\r\nHost: monip.org\r\n\r\n";
|
|
||||||
size_t req_len = strlen(req);
|
|
||||||
if (req_len != write(sock, req, req_len)) {
|
|
||||||
fprintf(stderr, "partial/failed write\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
char page[256];
|
|
||||||
size_t nread = 0;
|
|
||||||
while ((nread = read(sock, page, sizeof(char) * 255)) > 0) {
|
|
||||||
//printf("%s\n", nread);
|
|
||||||
fwrite(page, nread, 1, stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(sock);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define RING_BUFFER_SIZE 1024
|
// 1500 = internet MTU
|
||||||
|
#define RING_BUFFER_SIZE 1500
|
||||||
|
|
||||||
struct ring_buffer {
|
struct ring_buffer {
|
||||||
char buffer[RING_BUFFER_SIZE];
|
char buffer[RING_BUFFER_SIZE];
|
||||||
|
|
Loading…
Reference in a new issue