dio_domain_fronting

Creator: coderz1093

Last updated:

0 purchases

dio_domain_fronting Image
dio_domain_fronting Images

Languages

Categories

Add to Cart

Description:

dio domain fronting

Dio Domain Fronting #
A DomainFronting plugin for dio.
Get started #
Add dependency #
dependencies:
dio: ^4.0.0
dio_domain_fronting: ^1.0.0
copied to clipboard
Super simple to use #
import 'dart:io';
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'package:dio_domain_fronting/dio_domain_fronting.dart';

void main() async {
final dio = Dio();

final hosts = {
'example.com': '93.184.216.34',
};

final domainFronting = DomainFronting(
dnsLookup: (host) => hosts[host],
);

// Ignore certificate errors
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
return hosts.containsValue(host);
};
};

// Add the plug-ins after the others have been added to ensure the correct order of execution
domainFronting.bind(dio);

// A switch that can be used to disable the function.
// domainFronting.enable = false;

final response = await dio.get('https://example.com/');
}

copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.