Exemplo n.º 1
0
        public Startup(DirectoryInfo baseDataDir, Uri proxyUri, Uri[] targetUris, Uri controlUri, Uri uiUri = null)
        {
            var baseDir = baseDataDir;
            var logger  = new HttpLogger(baseDir);

            apps = new List <HttpAppBase>();

            var proxy = new HttpProxy(proxyUri, targetUris);

            {
                proxy.AnalyserEngine.Register(new RequestStore(baseDir, logger));
                proxy.AnalyserEngine.Register(logger);
                proxy.AnalyserEngine.Register(new TextIndexer(baseDir, logger));
                //proxy.AnalyserEngine.Register(new RequestFeatureMap(baseDir, logger));

                proxy.ApplicationHost.StatusChanged += (s, v) =>
                {
                    Console.WriteLine("Proxy status = {0}", v.Value);
                };

                var control = new HttpController(controlUri, proxy);

                Console.WriteLine("Binding to {0}", proxyUri);
                Console.WriteLine("Control via {0}", controlUri);

                if (uiUri != null)
                {
                    var app = new WebPortal(uiUri);

                    control.AllowOrigin(uiUri);

                    apps.Add(app);

                    Console.WriteLine("Admin portal via {0}", uiUri);
                }

                apps.Add(proxy);
                apps.Add(control);
            }
        }
Exemplo n.º 2
0
 public HttpController(Uri hostAddress, HttpProxy proxy) : base(hostAddress)
 {
     _proxy = proxy;
 }