dns_checker.h
861 Bytes
//
// ipv4_ipv6_checker.hpp
// BBAAPIRequest
//
// Created by Cai,Rui(MAD) on 2018/9/13.
//
#ifndef SMARTHTTPDNS_DNS_CHECKER_H_
#define SMARTHTTPDNS_DNS_CHECKER_H_
#include <stdio.h>
namespace smarthttpdns {
class DnsChecker {
private:
// last time IPv6 cache time
int64_t last_ipv6_probe_time_;
// last time IPv4 cache time
int64_t last_ipv4_probe_time_;
// isIPv4Reachable last cache
bool last_ipv6_probe_result_;
// isIPv6Reachable last cache
bool last_ipv4_probe_result_;
// gets the current UTC time.
void getCurrentTime(int64_t* second);
// check IPv4/IPv6 Avaliable
bool isGloballyReachable(bool isIPv4);
public:
bool isIPv4Reachable();
bool isIPv6Reachable();
};
}
#endif // SMARTHTTPDNS_DNS_CHECKER_H_