Ejemplo n.º 1
0
        public static SpiderProxyServer StartNew(ExplicitProxyEndPoint endPoint, SpiderProxyServerEventOption eventOption)
        {
            var server = new SpiderProxyServer();

            server.TryAddEventOption(eventOption);
            server.CertificateManager.TrustRootCertificate(true);            //locally trust root certificate used by this proxy.
            server.AddEndPoint(endPoint);
            server.SetAsSystemHttpProxy(endPoint);
            server.SetAsSystemHttpsProxy(endPoint);
            server.Start();
            return(server);
        }
Ejemplo n.º 2
0
 public bool TryAddEventOption(SpiderProxyServerEventOption eventOption)
 {
     if (IsClosed)
     {
         return(false);
     }
     if (eventOption is null)
     {
         return(false);
     }
     _eventOptions.Add(eventOption);
     eventOption.Bind(this);
     return(true);
 }