I am trying to combine GeckoFx library and Tor.NET library.
In my code I do all preparing to use tor network,
ClientCreateParams createParameters = new ClientCreateParams();
createParameters.ConfigurationFile = ConfigurationManager.AppSettings["torConfigurationFile"];
createParameters.ControlPassword = ConfigurationManager.AppSettings["torControlPassword"];
createParameters.ControlPort = Convert.ToInt32(ConfigurationManager.AppSettings["torControlPort"]);
createParameters.DefaultConfigurationFile = ConfigurationManager.AppSettings["torDefaultConfigurationFile"];
createParameters.Path = Path.Combine(root, ConfigurationManager.AppSettings["torPath"]);
createParameters.SetConfig(ConfigurationNames.AvoidDiskWrites, true);
createParameters.SetConfig(ConfigurationNames.GeoIPFile, Path.Combine(root, @"Tor\Data\Tor\geoip"));
createParameters.SetConfig(ConfigurationNames.GeoIPv6File, Path.Combine(root, @"Tor\Data\Tor\geoip6"));
client = Client.Create(createParameters);
<appSettings>
<add key="torConfigurationFile" value=""/>
<add key="torControlPassword" value=""/>
<add key="torControlPort" value="9051"/>
<add key="torDefaultConfigurationFile" value=""/>
<add key="torPath" value="Tor\Tor\tor.exe"/>
</appSettings>
WebBrowser1 is a simple browser and it works with Tor settings. But browser is GeckoFx and it doesn't work.
webBrowser1.Navigate("https://duckduckgo.com/?q=my+ip&t=h_&ia=answer");
browser.Navigate("https://duckduckgo.com/?q=my+ip&t=h_&ia=answer");
As you see ip should be as on left control. You can download and test full project from here. It is WinForms project just run "Gecko" project from solution. Any idea how to set GeckoFx use Tor network? Or maybe I need somehow setup GeckoFx to use proxy?
//GeckoPreferences.User["network.proxy.type"] = 1;
//GeckoPreferences.User["network.proxy.socks"] = "127.0.0.1";
//GeckoPreferences.User["network.proxy.socks_port"] = 9150;
//GeckoPreferences.User["network.proxy.socks_version"] = 5;
//GeckoPreferences.User["network.proxy.socks_remote_dns"] = true;
VisualStudio 2015. Thank you.
Have you set any of the Firefox Preferences in your code before initializing the browser?
Try:
The
network.proxy.type
value of 1 is equivalent to "Manual Proxy Configuration" settings.The following settings configure the SOCKS proxy settings to use Tor at 127.0.0.1:9050 with DNS resolution over SOCKS (Tor).
It seems like this should properly configure GeckoFX to use Tor.