platform_proxy

Last updated:

0 purchases

platform_proxy Image
platform_proxy Images
Add to Cart

Description:

platform proxy

platform_proxy #
Flutter support only limited Proxy configuration out of the box. All that we can do it's provide system environment variables http_proxy, https_proxy, e.t.c more details in documentation. If you won't define the variables, your http requests will bypass system proxy configuration.
This plugin is here to fix this.
Proxy config matrix #
Different OSes provide different options to configure proxy for user. Table below will try to represent the options. (Feel free to point out if something missed)



OS
Manual
Manual + Credentials
Manual + Bypass
AutoProxy config (PAC)




Android






iOS






Windows






Mac OS






Linux
in_progress
in_progress
in_progress
in_progress



What platform_proxy plugin supports #
Table below represent configuration options from Proxy config matrix which suppurted by the plugin.



OS
Manual
Manual + Credentials
Manual + Bypass
AutoProxy config (PAC)




Android






iOS






Windows






Mac OS






Linux
in_progress
in_progress
in_progress
in_progress



Getting Started #
Work is still in progress. There is an issue in Dart SDK itself which block easy integration of system proxy configuration.
Instance of PlatformProxy class provides list of Proxy which enabled for provided url.

Yes we have to request proxy configuration for every URL requested from our app, to get correct configuration. Even if a system has configuration for a proxy it doesn't mean that the proxy is enabled for the URL (e.g. bypass option and PAC)

Then the proxy configuration have to be provided with findProxy method. The method support extended PAC string (original one doesn't support credentials). To simplify this the plugin has extension to convert Iterable<Proxy> to PAC string with or without credentials:
var platformProxy = PlatformProxy();
var proxies = await _platformProxy.getPlatformProxies(url: "your url");
var pacString = proxies.getProxiesAsPac();
or
var pacString = proxies.pacStringWithCredentials();
copied to clipboard
Unfortunately findProxy method is synchronous and we are not allowed to use await there. Before that problem is fixed you can try to use ProxyAwareHttpClient for dart.io HttpClient which prefetch proxy configuration before make real request.
final client = ProxyAwareHttpClient(client: HttpClient(), platformProxy: PlatformProxy());
client.getUrl(Uri.parse('https://flutter.dev')).then((value) => value.close()).then((value) {});
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.