/// <summary>
 /// load the certicicate defined in the configuration file
 /// </summary>
 public HttpsProxyListener(BabaluProxiedServer proxiedServer,int port, string cert)
     : base(proxiedServer, port)
 {
     _cert = GetServerCert(cert);
 }
Exemplo n.º 2
0
        /// <summary>
        /// start any listeners that are configured
        /// </summary>
        /// <returns></returns>
        private static void Start(BabaluProxiedServer proxiedServer)
        {
            List<ProxyListener> listeners = new List<ProxyListener>();
            foreach (int port in proxiedServer.ProxyPorts.Keys)
            {
                string cert = proxiedServer.ProxyPorts[port];
                if (string.IsNullOrWhiteSpace(cert))
                    listeners.Add(new HttpProxyListener(proxiedServer, port));
                else
                    listeners.Add(new HttpsProxyListener(proxiedServer, port, cert));
            }

            List<ProxyListener> started = new List<ProxyListener>();
            foreach(ProxyListener listener in listeners)
            {
                try
                {
                    listener.StartListner();
                    started.Add(listener);
                }
                catch
                {
                    foreach (ProxyListener startedListner in started)
                    {
                        try
                        {
                            startedListner.StopWork();
                        }
                        catch(Exception excp)
                        {
                            LogFactory.LogException(excp, "Unxpected error stopping pending Babalu Proxy Listener");
                        }
                    }
                    throw;
                }
            }

            foreach (ProxyListener listener in started)
            {
                _proxyListeners.Add(listener);
            }
        }
Exemplo n.º 3
0
 protected ProxyListener(BabaluProxiedServer proxiedServer, int port )
 {
     _proxiedServer = proxiedServer;
     ProxyServerPort = port;
 }
Exemplo n.º 4
0
 public HttpProxyListener(BabaluProxiedServer proxiedServer, int overridePort)
     : base(proxiedServer, overridePort)
 {
 }