Ejemplo n.º 1
0
        /// <summary>
        /// Clear all proxy settings for current machine
        /// </summary>
        public void DisableAllSystemProxies()
        {
            if (RunTime.IsRunningOnMono())
            {
                throw new Exception("Mono Runtime do not support system proxy settings.");
            }

            systemProxySettingsManager.DisableAllProxy();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the given explicit end point as the default proxy server for current machine
        /// </summary>
        /// <param name="endPoint"></param>
        public void SetAsSystemHttpProxy(ExplicitProxyEndPoint endPoint)
        {
            if (RunTime.IsRunningOnMono())
            {
                throw new Exception("Mono Runtime do not support system proxy settings.");
            }

            ValidateEndPointAsSystemProxy(endPoint);

            //clear any settings previously added
            ProxyEndPoints.OfType <ExplicitProxyEndPoint>().ToList().ForEach(x => x.IsSystemHttpProxy = false);

            systemProxySettingsManager.SetHttpProxy(
                Equals(endPoint.IpAddress, IPAddress.Any) | Equals(endPoint.IpAddress, IPAddress.Loopback) ? "127.0.0.1" : endPoint.IpAddress.ToString(), endPoint.Port);

            endPoint.IsSystemHttpProxy = true;
#if !DEBUG
            firefoxProxySettingsManager.AddFirefox();
#endif
            Console.WriteLine("Set endpoint at Ip {0} and port: {1} as System HTTP Proxy", endPoint.IpAddress, endPoint.Port);
        }
        internal CertificateManager(CertificateEngine engine,
                                    string issuer,
                                    string rootCertificateName,
                                    Action <Exception> exceptionFunc)
        {
            this.exceptionFunc = exceptionFunc;

            //For Mono only Bouncy Castle is supported
            if (RunTime.IsRunningOnMono() ||
                engine == CertificateEngine.BouncyCastle)
            {
                certEngine = new BCCertificateMaker();
            }
            else
            {
                certEngine = new WinCertificateMaker();
            }

            Issuer = issuer;
            RootCertificateName = rootCertificateName;

            certificateCache = new ConcurrentDictionary <string, CachedCertificate>();
        }