mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
fix windows build
This commit is contained in:
parent
c84dc794fa
commit
aaff3de0a7
@ -1 +1 @@
|
||||
5808
|
||||
5809
|
||||
|
@ -18,6 +18,20 @@ namespace Qv2ray::components::latency
|
||||
virtual ~DNSBase();
|
||||
|
||||
protected:
|
||||
int isAddr()
|
||||
{
|
||||
auto host = req.host.toStdString();
|
||||
if (uv_ip4_addr(host.data(), req.port, reinterpret_cast<sockaddr_in *>(&storage)) == 0)
|
||||
{
|
||||
return AF_INET;
|
||||
}
|
||||
if (uv_ip6_addr(host.data(), req.port, reinterpret_cast<sockaddr_in6 *>(&storage)) == 0)
|
||||
{
|
||||
return AF_INET6;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
template<typename E, typename H>
|
||||
void async_DNS_lookup(E &&e, H &&h)
|
||||
{
|
||||
|
@ -2,22 +2,9 @@
|
||||
|
||||
#include "LatencyTestThread.hpp"
|
||||
#include "core/handler/ConfigHandler.hpp"
|
||||
#include "uvw.hpp"
|
||||
|
||||
namespace Qv2ray::components::latency
|
||||
{
|
||||
int isAddr(const char *host, int port, struct sockaddr_storage *storage, int ipv6first)
|
||||
{
|
||||
if (uv_ip4_addr(host, port, reinterpret_cast<sockaddr_in *>(storage)) == 0)
|
||||
{
|
||||
return AF_INET;
|
||||
}
|
||||
if (uv_ip6_addr(host, port, reinterpret_cast<sockaddr_in6 *>(storage)) == 0)
|
||||
{
|
||||
return AF_INET6;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
LatencyTestHost::LatencyTestHost(const int defaultCount, QObject *parent) : QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<ConnectionId>();
|
||||
|
@ -27,8 +27,6 @@ namespace Qv2ray::components::latency
|
||||
Qv2rayLatencyTestingMethod method;
|
||||
};
|
||||
|
||||
int isAddr(const char *host, int port, struct sockaddr_storage *storage, int ipv6first);
|
||||
|
||||
class LatencyTestHost : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -36,7 +36,7 @@ namespace Qv2ray::components::latency::tcping
|
||||
data.failedCount = 0;
|
||||
data.worst = 0;
|
||||
data.avg = 0;
|
||||
af = isAddr(req.host.toStdString().data(), req.port, &storage, 0);
|
||||
af = isAddr();
|
||||
if (af == -1)
|
||||
{
|
||||
getAddrHandle = loop->resource<uvw::GetAddrInfoReq>();
|
||||
|
@ -73,7 +73,7 @@ namespace Qv2ray::components::latency::icmping
|
||||
data.failedCount = 0;
|
||||
data.worst = 0;
|
||||
data.avg = 0;
|
||||
if (isAddr(req.host.toStdString().data(), req.port, &storage, 0) == -1)
|
||||
if (isAddr() == -1)
|
||||
{
|
||||
getAddrHandle = loop->resource<uvw::GetAddrInfoReq>();
|
||||
sprintf(digitBuffer, "%d", req.port);
|
||||
|
@ -11,10 +11,11 @@ typedef struct _IO_STATUS_BLOCK
|
||||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
||||
typedef VOID(NTAPI *PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved);
|
||||
#define PIO_APC_ROUTINE_DEFINED
|
||||
#include <IcmpAPI.h>
|
||||
#include <WS2tcpip.h>
|
||||
#include <Windows.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <IcmpAPI.h>
|
||||
#include <QString>
|
||||
|
||||
namespace Qv2ray::components::latency::icmping
|
||||
{
|
||||
@ -129,7 +130,7 @@ namespace Qv2ray::components::latency::icmping
|
||||
data.failedCount = 0;
|
||||
data.worst = 0;
|
||||
data.avg = 0;
|
||||
af = isAddr(req.host.toStdString().data(), req.port, &storage, 0);
|
||||
af = isAddr();
|
||||
if (af == -1)
|
||||
{
|
||||
getAddrHandle = loop->resource<uvw::GetAddrInfoReq>();
|
||||
|
@ -3,14 +3,8 @@
|
||||
#include <QtGlobal>
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#include "components/latency/LatencyTest.hpp"
|
||||
|
||||
#include "../DNSBase.hpp"
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
namespace Qv2ray::components::latency::icmping
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user