Add get_simple_config_mozilla_dns.
GitOrigin-RevId: 53ffccf02ebd41d4b11146ae3b0206f6fa5db5aa
This commit is contained in:
parent
0e2898b81e
commit
2e0949c10a
@ -229,9 +229,9 @@ ActorOwn<> get_simple_config_azure(Promise<SimpleConfigResult> promise, const Co
|
||||
return get_simple_config_impl(std::move(promise), scheduler_id, std::move(url), "tcdnb.azureedge.net", prefer_ipv6);
|
||||
}
|
||||
|
||||
ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfigResult> promise, const ConfigShared *shared_config,
|
||||
bool is_test, int32 scheduler_id) {
|
||||
VLOG(config_recoverer) << "Request simple config from Google DNS";
|
||||
static ActorOwn<> get_simple_config_dns(Slice address, Slice host, Promise<SimpleConfigResult> promise,
|
||||
const ConfigShared *shared_config, bool is_test, int32 scheduler_id) {
|
||||
VLOG(config_recoverer) << "Request simple config from DNS";
|
||||
#if TD_EMSCRIPTEN // FIXME
|
||||
return ActorOwn<>();
|
||||
#else
|
||||
@ -281,12 +281,24 @@ ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfigResult> promise, con
|
||||
return std::move(res);
|
||||
}());
|
||||
}),
|
||||
PSTRING() << "https://www.google.com/resolve?name=" << url_encode(name) << "&type=16",
|
||||
std::vector<std::pair<string, string>>({{"Host", "dns.google.com"}}), timeout, ttl, prefer_ipv6,
|
||||
SslStream::VerifyPeer::Off));
|
||||
PSTRING() << "https://" << address << "?name=" << url_encode(name) << "&type=16",
|
||||
std::vector<std::pair<string, string>>({{"Host", host.str()}, {"Accept", "application/dns-json"}}), timeout, ttl,
|
||||
prefer_ipv6, SslStream::VerifyPeer::Off));
|
||||
#endif
|
||||
}
|
||||
|
||||
ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfigResult> promise, const ConfigShared *shared_config,
|
||||
bool is_test, int32 scheduler_id) {
|
||||
return get_simple_config_dns("www.google.com/resolve", "dns.google.com", std::move(promise), shared_config, is_test,
|
||||
scheduler_id);
|
||||
}
|
||||
|
||||
ActorOwn<> get_simple_config_mozilla_dns(Promise<SimpleConfigResult> promise, const ConfigShared *shared_config,
|
||||
bool is_test, int32 scheduler_id) {
|
||||
return get_simple_config_dns("mozilla.cloudflare-dns.com/dns-query", "mozilla.cloudflare-dns.com", std::move(promise),
|
||||
shared_config, is_test, scheduler_id);
|
||||
}
|
||||
|
||||
ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorShared<> parent) {
|
||||
class SessionCallback : public Session::Callback {
|
||||
public:
|
||||
|
@ -41,6 +41,9 @@ ActorOwn<> get_simple_config_azure(Promise<SimpleConfigResult> promise, const Co
|
||||
ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfigResult> promise, const ConfigShared *shared_config,
|
||||
bool is_test, int32 scheduler_id);
|
||||
|
||||
ActorOwn<> get_simple_config_mozilla_dns(Promise<SimpleConfigResult> promise, const ConfigShared *shared_config,
|
||||
bool is_test, int32 scheduler_id);
|
||||
|
||||
class HttpDate {
|
||||
static bool is_leap(int32 year) {
|
||||
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
|
||||
|
@ -166,8 +166,10 @@ TEST(Mtproto, config) {
|
||||
|
||||
run(get_simple_config_azure, false);
|
||||
run(get_simple_config_google_dns, false);
|
||||
run(get_simple_config_mozilla_dns, false);
|
||||
run(get_simple_config_azure, true);
|
||||
run(get_simple_config_google_dns, true);
|
||||
run(get_simple_config_mozilla_dns, true);
|
||||
}
|
||||
cnt--;
|
||||
sched.start();
|
||||
|
Reference in New Issue
Block a user