Skip to content

Commit

Permalink
hotfix: Change DNS lookups default adresses
Browse files Browse the repository at this point in the history
  • Loading branch information
0niel committed Feb 25, 2023
1 parent 4f2c1e0 commit 358a7c4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
30 changes: 30 additions & 0 deletions lib/common/utils/connection_checker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart';

/// The default parameters for DNS lookups
const Map<String, String> dnsParameters = {
'name': 'ya.ru',
'type': 'A',
'dnssec': '1',
};

/// The default headers for DNS lookups
const Map<String, String> dnsHeaders = {
'Accept': 'application/dns-json',
'Cache-Control': 'no-cache',
'Content-Type': 'application/json',
};

final List<AddressCheckOptions> defaultAddresses = [
AddressCheckOptions(
Uri.parse('https://yandex.cloudflare-dns.com/dns-query').replace(
queryParameters: dnsParameters,
),
headers: dnsHeaders,
),
AddressCheckOptions(
Uri.parse('https://mozilla.cloudflare-dns.com/dns-query').replace(
queryParameters: dnsParameters,
),
headers: dnsHeaders,
),
];
5 changes: 4 additions & 1 deletion lib/service_locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:dio/dio.dart';
import 'package:get_it/get_it.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:rtu_mirea_app/common/oauth.dart';
import 'package:rtu_mirea_app/common/utils/connection_checker.dart';
import 'package:rtu_mirea_app/data/datasources/app_settings_local.dart';
import 'package:rtu_mirea_app/data/datasources/forum_local.dart';
import 'package:rtu_mirea_app/data/datasources/forum_remote.dart';
Expand Down Expand Up @@ -248,7 +249,9 @@ Future<void> setup() async {
encryptedSharedPreferences: true,
));
getIt.registerLazySingleton(() => secureStorage);
getIt.registerLazySingleton(() => InternetConnectionCheckerPlus());
getIt.registerLazySingleton(() =>
InternetConnectionCheckerPlus.createInstance(
addresses: defaultAddresses));
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
getIt.registerLazySingleton(() => packageInfo);
getIt.registerLazySingleton(() => LksOauth2());
Expand Down

0 comments on commit 358a7c4

Please sign in to comment.