mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Add SRV record support for win32
This commit is contained in:
parent
fff50a7d80
commit
13efdfe86d
1
Makefile
1
Makefile
|
@ -185,6 +185,7 @@ src/edge: $(N2N_LIB)
|
|||
src/supernode: $(N2N_LIB)
|
||||
|
||||
ifneq (,$(findstring mingw,$(CONFIG_HOST_OS)))
|
||||
LDLIBS+=-ldnsapi
|
||||
N2N_OBJS+=src/win32/edge_utils_win32.o
|
||||
N2N_OBJS+=src/win32/getopt1.o
|
||||
N2N_OBJS+=src/win32/getopt.o
|
||||
|
|
14
src/edge.c
14
src/edge.c
|
@ -579,6 +579,20 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e
|
|||
|
||||
case 'l': /* supernode-list */ {
|
||||
if(optargument) {
|
||||
#ifdef _WIN32
|
||||
#include <Winsock2.h>
|
||||
#include <windns.h>
|
||||
DNS_RECORDA* pDnsRecord = NULL;
|
||||
DnsQuery_A(optargument, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD*)&pDnsRecord, NULL);
|
||||
while (pDnsRecord != NULL) {
|
||||
if (pDnsRecord->wType == DNS_TYPE_SRV) {
|
||||
DNS_SRV_DATAA pSrvData = pDnsRecord->Data.SRV;
|
||||
sprintf(optargument, "%s:%d\0", pSrvData.pNameTarget, pSrvData.wPort);
|
||||
break;
|
||||
}
|
||||
pDnsRecord = pDnsRecord->pNext;
|
||||
}
|
||||
#endif
|
||||
if(edge_conf_add_supernode(conf, optargument) != 0) {
|
||||
traceEvent(TRACE_WARNING, "failed to add supernode '%s'", optargument);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user