void StartProxy() { const string PORNHUB_HOST = "www.livehub.com"; const string IWARA_HOST = "iwara.tv"; var pornhubListensEndPoint = ServerInfo.PornhubProxyEndPoint; var pacListensEndPoint = ServerInfo.PacServerEndPoint; var adErrorEndpoint = ServerInfo.ADErrorEndPoint; var iwaraLsitensPoint = ServerInfo.IwaraProxyEndPoint; var adVido = ServerInfo.AdVideo; var caFile = ServerInfo.CaCert; var mainCert = new X509Certificate2(ServerInfo.PornCert); var adCert = new X509Certificate2(ServerInfo.AdCert); PacServer.Builder.Create(pacListensEndPoint) .Add((host) => host == "www.pornhub.com", ProxyMode.CreateHTTP(adErrorEndpoint)) .Add((host) => host == "hubt.pornhub.com", ProxyMode.CreateHTTP(adErrorEndpoint)) .Add((host) => host == "ajax.googleapis.com", ProxyMode.CreateHTTP(adErrorEndpoint)) .Add((host) => PacMethod.dnsDomainIs(host, "pornhub.com"), ProxyMode.CreateHTTP(pornhubListensEndPoint)) .Add((host) => PacMethod.dnsDomainIs(host, "adtng.com"), ProxyMode.CreateHTTP(pornhubListensEndPoint)) .Add((host) => host == "i.iwara.tv", ProxyMode.CreateDIRECT()) .Add((host) => PacMethod.dnsDomainIs(host, IWARA_HOST), ProxyMode.CreateHTTP(iwaraLsitensPoint)) .StartPACServer(); PornhubProxyInfo info = new PornhubProxyInfo { MainPageStreamCreate = ConnectHelper.CreateLocalStream(new X509Certificate2(mainCert), SslProtocols.Tls12), ADPageStreamCreate = ConnectHelper.CreateLocalStream(new X509Certificate2(adCert), SslProtocols.Tls12), RemoteStreamCreate = ConnectHelper.CreateRemoteStream(PORNHUB_HOST, 443, PORNHUB_HOST, (a, b) => new MHttpStream(a, b), SslProtocols.Tls12), MaxContentSize = 1024 * 1024 * 5, ADVideoBytes = adVido, CheckingVideoHtml = PornhubHelper.CheckingVideoHtml, MaxRefreshRequestCount = 30, ReplaceResponseHtml = PornhubHelper.ReplaceResponseHtml, ListenIPEndPoint = pornhubListensEndPoint }; Task t1 = PornhubProxyServer.Start(info).Task; TunnelProxyInfo iwaraSniInfo = new TunnelProxyInfo() { ListenIPEndPoint = iwaraLsitensPoint, CreateLocalStream = ConnectHelper.CreateDnsLocalStream(), CreateRemoteStream = ConnectHelper.CreateDnsRemoteStream( 443, "104.26.12.12", "104.20.201.232", "104.24.48.227", "104.22.27.126", "104.24.53.193") }; Task t2 = TunnelProxy.Start(iwaraSniInfo).Task; }