system_proxy_resolver 1.0.0 copy "system_proxy_resolver: ^1.0.0" to clipboard
system_proxy_resolver: ^1.0.0 copied to clipboard

A Dart Package to get system proxy settings with support of PAC scripts.

system_proxy_resolver #

pub package

A Dart Package to read proxy settings from the OS. With this plugin you can resolve proxy setting for specific URL via PAC scripts. system_proxy_resolver can be used in pure Dart as well!

Features #

  • FFI implementation so that package can be used from any isolate without additional configuration
  • Support for both pure Dart and Flutter projects
  • iOS&macOS support via CFNetwork
  • Windows support via WinHTTP
  • Android support via IProxyService
  • Linux support via libproxy

Usage #

final resolver = SystemProxyResolver();
print(resolver.getSystemProxySettings());
print(await resolver.getProxyForUrl(Uri.parse("https://pub.dev")));

Usage with delayed_proxy_http_client

final client = DelayedProxyHttpClient();
client.findProxyAsync = (url) async {
  try {
    final proxies = await proxyResolver.getProxyForUrl(url);
    return proxies.map((e) => e.direct ? "DIRECT" : "PROXY ${e.host}:${e.port}").join("; ");
  } on Object catch (e) {
    return "DIRECT";
  }
};

...