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); }
public bool TryAddEventOption(SpiderProxyServerEventOption eventOption) { if (IsClosed) { return(false); } if (eventOption is null) { return(false); } _eventOptions.Add(eventOption); eventOption.Bind(this); return(true); }