Expert Flutter Developer Needed for Advanced Proxy Integration in Android Browser App

Заказчик: AI | Опубликовано: 29.12.2025
Бюджет: 250 $

I want to implement a special "Smart Proxy Failover System" in my existing Flutter Android browser app. This system will automatically recognize blocked websites and reload them with the proxy turned on. Project's core requirements: 1. Packet Capture & Content Analysis: The app will monitor every request. If no data is transferred within 5 seconds or if the HTML content is less than 3 KB within 7 seconds, the proxy will be activated. 2. Proxy Integration: Webshare rotating SOCKS5 gateway must be used. 3. Firebase Admin Control: The proxy IP, port, and credentials will be dynamically loaded from the Firebase Realtime Database. 4. Domain Sensitivity: The proxy will only work for specific domains. As soon as the domain changes, the proxy will be deactivated. 5. Single Reload Policy: To maintain a smooth user experience, the page will reload only once after the proxy is activated. Below is the logic and basic code structure of my project. Please bid only if you understand this code and can perfectly implement proxy handling and authentication (Username/Password) using flutter_inappwebview. Code ✓ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:firebase_database/firebase_database.dart'; class SmartProxyBrowser extends StatefulWidget { @override _SmartProxyBrowserState createState() => _SmartProxyBrowserState(); } class _SmartProxyBrowserState extends State<SmartProxyBrowser> { InAppWebViewController? webViewController; Timer? _proxyTimer; // প্রক্সি স্ট্যাটাস bool isProxyActive = false; bool hasReloadedForProxy = false; String? activeProxyDomain; // নেটওয়ার্ক ট্র্যাকিং int networkRequestCount = 0; // Firebase থেকে লোড করা প্রক্সি তথ্য (Webshare gateway) String proxyHost = ''; // যেমন: p.webshare.io int proxyPort = 0; // যেমন: 8000 String proxyUsername = ''; String proxyPassword = ''; @override void initState() { super.initState(); _loadProxySettingsFromFirebase(); // অ্যাপ শুরুতেই লোড করো } // Firebase থেকে প্রক্সি সেটিংস লোড করা Future<void> _loadProxySettingsFromFirebase() async { try { DatabaseReference ref = FirebaseDatabase.instance.ref("proxy_settings"); DataSnapshot snapshot = await ref.get(); if (snapshot.exists) { Map<dynamic, dynamic> data = snapshot.value as Map<dynamic, dynamic>; setState(() { proxyHost = data['host'] ?? ''; proxyPort = int.tryParse(data['port'].toString()) ?? 0; proxyUsername = data['username'] ?? ''; proxyPassword = data['password'] ?? ''; }); print("Proxy settings loaded from Firebase:"); print("Host: $proxyHost:$proxyPort"); print("Username: $proxyUsername"); } else { print("No proxy settings found in Firebase"); } } catch (e) { print("Error loading proxy settings: $e"); } } // প্রক্সি গেটওয়ে সেট করা + একবার রিলোড Future<void> _activateProxyAndReload(WebUri url) async { if (isProxyActive || hasReloadedForProxy) return; if (proxyHost.isEmpty || proxyPort == 0) { print("Proxy details not loaded yet!"); return; } // Webshare rotating SOCKS5 gateway সেট করো await ProxyController.instance().setProxyOverride( settings: ProxySettings( proxyRules: [ ProxyRule(url: "socks5://$proxyHost:$proxyPort"), ], ), ); setState(() { isProxyActive = true; hasReloadedForProxy = true; activeProxyDomain = url.host; }); print("Rotating Proxy ACTIVE → New IP assigned → Reloading: ${url.host}"); // সরাসরি রিলোড – rotating gateway খুব দ্রুত কাজ করে webViewController?.loadUrl(urlRequest: URLRequest(url: url)); } // প্রক্সি গেটওয়ে ক্লিয়ার করা (ডোমেইন চেঞ্জ হলে) Future<void> _resetProxy() async { await ProxyController.instance().clearProxyOverride(); setState(() { isProxyActive = false; hasReloadedForProxy = false; activeProxyDomain = null; }); print("Proxy gateway CLEARED"); } @override Widget build(BuildContext context) { return InAppWebView( initialUrlRequest: URLRequest(url: WebUri("https://google.com")), initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( useOnLoadResource: true, // রিকোয়েস্ট কাউন্টের জন্য জরুরি ), android: AndroidInAppWebViewOptions( useHybridComposition: true, ), ), onWebViewCreated: (controller) { webViewController = controller; }, onLoadStart: (controller, url) async { if (url == null) return; // নতুন পেজ লোড শুরু → কাউন্ট রিসেট networkRequestCount = 0; // ডোমেইন চেঞ্জ হলে প্রক্সি ক্লিয়ার করো if (isProxyActive && url.host != activeProxyDomain) { await _resetProxy(); } // প্রক্সি ইতিমধ্যে চালু থাকলে → কোনো চেক করার দরকার নেই if (isProxyActive) return; // পুরানো টাইমার বাতিল _proxyTimer?.cancel(); hasReloadedForProxy = false; // প্রথম চেক: ৫ সেকেন্ড পর _proxyTimer = Timer(const Duration(seconds: 5), () async { int bodyLength = await controller.evaluateJavascript( source: "document.body ? document.body.innerHTML.trim().length : 0;") ?? 0; // লজিক ১: ৫ সেকেন্ডে বডি খালি if (bodyLength == 0) { _proxyTimer?.cancel(); await _activateProxyAndReload(url); return; } // শুধু প্রথম চেক ফেল হলে → দ্বিতীয় চেক _proxyTimer = Timer(const Duration(seconds: 2), () async { int bodyLength7s = await controller.evaluateJavascript( source: "document.body ? document.body.innerHTML.trim().length : 0;") ?? 0; // লজিক ২: ৭ সেকেন্ডে HTML < 3KB এবং ≤ ৩টা রিকোয়েস্ট if (bodyLength7s < 3072 && networkRequestCount <= 3) { await _activateProxyAndReload(url); } }); }); }, onLoadResource: (controller, resource) { networkRequestCount++; }, // প্রক্সি অথেনটিকেশন (Webshare-এর জন্য জরুরি) onReceivedHttpAuthRequest: (controller, challenge) async { if (isProxyActive && proxyUsername.isNotEmpty) { return HttpAuthResponse( username: proxyUsername, password: proxyPassword, action: HttpAuthResponseAction.PROCEED, permanentPersistence: true, ); } return HttpAuthResponse(action: HttpAuthResponseAction.CANCEL); }, onLoadStop: (controller, url) { _proxyTimer?.cancel(); }, ); } @override void dispose() { _proxyTimer?.cancel(); super.dispose(); } }