public TorHandler(bool block = false, string path = "tor", int httpsport = 8080) { this.httpsport = httpsport; this.torprocess.StartInfo.FileName = path; this.torprocess.StartInfo.UseShellExecute = false; this.torprocess.StartInfo.CreateNoWindow = true; this.torprocess.StartInfo.RedirectStandardOutput = true; int[] ports = utils.get_random_available_ports(2); this.socksport = ports[0]; this.controlport = ports[1]; this.torprocess.StartInfo.Arguments = string.Format("--socksport {0} --controlport {1}", this.socksport, this.controlport); this.torprocess.Start(); if (!block) { new Thread(check_readiness).Start(); } else { check_readiness(); } this.torConnectionHandler = new TorConnectionHandler(this.socksport); }
public HttpsServer(TorConnectionHandler torConnectionHandler, int httpsport) { this.httpsport = httpsport;//= utils.get_random_available_ports(1)[0]; this.startserver(); this.torConnectionHandler = torConnectionHandler; }