コード例 #1
0
        /// <summary>
        ///     Initializes a new instance of ProxyServer class with provided parameters.
        /// </summary>
        /// <param name="rootCertificateName">Name of the root certificate.</param>
        /// <param name="rootCertificateIssuerName">Name of the root certificate issuer.</param>
        public ProxyServer(string?rootCertificateName, string?rootCertificateIssuerName)
        {
            BufferPool           = new DefaultBufferPool();
            ProxyEndPoints       = new List <ProxyEndPoint>();
            tcpConnectionFactory = new TcpConnectionFactory(this);

            CertificateManager = new CertificateManager(rootCertificateName, rootCertificateIssuerName, ExceptionFunc);
        }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of ProxyServer class with provided parameters.
        /// </summary>
        /// <param name="rootCertificateName">Name of the root certificate.</param>
        /// <param name="rootCertificateIssuerName">Name of the root certificate issuer.</param>
        /// <param name="userTrustRootCertificate">
        ///     Should fake HTTPS certificate be trusted by this machine's user certificate
        ///     store?
        /// </param>
        /// <param name="machineTrustRootCertificate">Should fake HTTPS certificate be trusted by this machine's certificate store?</param>
        /// <param name="trustRootCertificateAsAdmin">
        ///     Should we attempt to trust certificates with elevated permissions by
        ///     prompting for UAC if required?
        /// </param>
        public ProxyServer(string?rootCertificateName, string?rootCertificateIssuerName,
                           bool userTrustRootCertificate    = true, bool machineTrustRootCertificate = false,
                           bool trustRootCertificateAsAdmin = false)
        {
            BufferPool           = new DefaultBufferPool();
            ProxyEndPoints       = new List <ProxyEndPoint>();
            tcpConnectionFactory = new TcpConnectionFactory(this);
            if (RunTime.IsWindows && !RunTime.IsUwpOnWindows)
            {
                systemProxySettingsManager = new SystemProxyManager();
            }

            CertificateManager = new CertificateManager(rootCertificateName, rootCertificateIssuerName,
                                                        userTrustRootCertificate, machineTrustRootCertificate, trustRootCertificateAsAdmin, ExceptionFunc);
        }
コード例 #3
0
        /// <summary>
        ///     Initializes a new instance of ProxyServer class with provided parameters.
        /// </summary>
        /// <param name="rootCertificateName">Name of the root certificate.</param>
        /// <param name="rootCertificateIssuerName">Name of the root certificate issuer.</param>
        /// <param name="userTrustRootCertificate">
        ///     Should fake HTTPS certificate be trusted by this machine's user certificate
        ///     store?
        /// </param>
        /// <param name="machineTrustRootCertificate">Should fake HTTPS certificate be trusted by this machine's certificate store?</param>
        /// <param name="trustRootCertificateAsAdmin">
        ///     Should we attempt to trust certificates with elevated permissions by
        ///     prompting for UAC if required?
        /// </param>
        public ProxyServer(string rootCertificateName, string rootCertificateIssuerName,
                           bool userTrustRootCertificate    = true, bool machineTrustRootCertificate = false,
                           bool trustRootCertificateAsAdmin = false)
        {
            // default values
            ConnectionTimeOutSeconds = 60;

            if (BufferPool == null)
            {
                BufferPool = new DefaultBufferPool();
            }

            ProxyEndPoints       = new List <ProxyEndPoint>();
            tcpConnectionFactory = new TcpConnectionFactory(this);
            if (!RunTime.IsRunningOnMono && RunTime.IsWindows)
            {
                systemProxySettingsManager = new SystemProxyManager();
            }

            CertificateManager = new CertificateManager(rootCertificateName, rootCertificateIssuerName,
                                                        userTrustRootCertificate, machineTrustRootCertificate, trustRootCertificateAsAdmin, ExceptionFunc);
        }