ioProxyConnector function
ProxyConnector
ioProxyConnector(})
Builds the ProxyConnector for config's network: block.
onBadCertificate overrides TLS certificate validation for the proxy
transport (https:// proxy URLs) and for the target TLS leg — null
keeps the platform default (self-signed corporate proxies fail
closed). environment overrides the password-variable lookup
(Platform.environment by default; a test seam). No config key exposes
either.
Implementation
ProxyConnector ioProxyConnector(
ProviderNetworkConfig config, {
bool Function(X509Certificate certificate)? onBadCertificate,
Map<String, String>? environment,
String? providerName,
}) {
final route = proxyRoute(config);
// The fail-closed error text names the PROVIDER (the card contract),
// not the config label.
final label = providerName ?? config.label;
return switch (config.scheme) {
'socks5' => _Socks5ProxyConnector(
config,
label,
route,
onBadCertificate,
environment,
),
'https' => _HttpsProxyConnector(
config,
label,
route,
onBadCertificate,
environment,
),
_ => _HttpProxyConnector(
config,
label,
route,
onBadCertificate,
environment,
),
};
}