示例#1
0
        public HttpFilteringEngine(FirewallCheckHandler firewallCheckFunc, HttpMessageBeginHandler httpMessageBeginFunc, HttpMessageEndHandler httpMessageEndFunc, string caBundleAbsPath = "none", ushort httpListenerPort = 0, ushort httpsListenerPort = 0, uint numThreads = 0)
        {
            m_nativeEngine = StaticAssemblyResolver.GetFilteringEngine(firewallCheckFunc, httpMessageBeginFunc, httpMessageEndFunc, caBundleAbsPath, httpListenerPort, httpsListenerPort, numThreads);

            InitListeners();
        }
示例#2
0
        public HttpFilteringEngine(FirewallCheckHandler firewallCheckFunc, HttpMessageBeginHandler httpMessageBeginFunc, HttpMessageEndHandler httpMessageEndFunc, ushort httpListenerPort = 0, ushort httpsListenerPort = 0, uint numThreads = 0)
        {
            BuildCaBundleWithLocalTrustedCerts();

            m_nativeEngine = StaticAssemblyResolver.GetFilteringEngine(firewallCheckFunc, httpMessageBeginFunc, httpMessageEndFunc, m_tmpCaBundlePath, httpListenerPort, httpsListenerPort, numThreads);

            InitListeners();
        }
        /// <summary>
        /// Gets a new instance of a trainer from the dynamically resolved mixed managed C++/CLI library.
        /// </summary>
        /// <returns>
        /// A new instance of the trainer class.
        /// </returns>
        public static IHttpFilteringEngine GetFilteringEngine(FirewallCheckHandler firewallCheckFunc, HttpMessageBeginHandler httpMessageBeginFunc, HttpMessageEndHandler httpMessageEndFunc, string caBundleAbsPath = "none", ushort httpListenerPort = 0, ushort httpsListenerPort = 0, uint numThreads = 0)
        {
            var exportedFeatureExtractors = s_targetAssembly.ExportedTypes.Where(x => x.GetInterfaces().Contains(typeof(IHttpFilteringEngine)));

            var res = exportedFeatureExtractors.FirstOrDefault();

            if (res != null)
            {
                IHttpFilteringEngine typedExport = (IHttpFilteringEngine)Activator.CreateInstance(res, firewallCheckFunc, httpMessageBeginFunc, httpMessageEndFunc, caBundleAbsPath, httpListenerPort, httpsListenerPort, numThreads);
                return(typedExport);
            }

            return(null);
        }