The bindings won't be too tied to the API internals so I can update them if cronet changes. I think it's a very useful library to use outside of Android and it's more lightweight than running headless chrome if you just need to run chrome's network stack.
I have been testing how to set the proxy and it looks like it's not too difficult to do it per cronet engine. Per request it seems difficult.
class ProxyConfigServiceSingle : public net::ProxyConfigService {
public:
// ProxyConfigServiceSingle implementation:
void AddObserver(Observer* observer) override {}
void RemoveObserver(Observer* observer) override {}
ConfigAvailability GetLatestProxyConfig(
net::ProxyConfigWithAnnotation* config) override {
auto proxy_config = net::ProxyConfig();
proxy_config.proxy_rules().ParseFromString("
http://localhost:8080");
auto annotation = net::DefineNetworkTrafficAnnotation("test", "test");
*config = net::ProxyConfigWithAnnotation(proxy_config, annotation);
return CONFIG_VALID;
}
};
and then modified CreateProxyConfigService to use it.