1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-05 20:26:46 +02:00

Ignore bootstrap nodes that use a domain instead of IP address

Domains cause toxcore to do blocking DNS requests which creates noticable lag
and might (??) leak IP addresses when using a proxy
This commit is contained in:
Jfreegman
2016-09-21 00:28:16 -04:00
parent 151f5f0c51
commit 221d761ff4
3 changed files with 17 additions and 1 deletions

View File

@ -26,7 +26,9 @@
#include <time.h>
#include <limits.h>
#include <dirent.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include "toxic.h"
#include "windows.h"
@ -478,3 +480,10 @@ void set_window_title(ToxWindow *self, const char *title, int len)
snprintf(self->name, sizeof(self->name), "%s", cpy);
}
/* Return true if address appears to be a valid ipv4 address. */
bool is_ip4_address(const char *address)
{
struct sockaddr_in s_addr;
return inet_pton(AF_INET, address, &(s_addr.sin_addr)) != 0;
}