Beispiel #1
0
        public void Start()
        {
            RMLog.Handler += RMLog_Handler;

            RMLog.Info("fTelnetProxy Starting Up");

            Config.Default.Load();
            ParseEnvironmentVariables();
            ParseCommandLineArgs();

            if ((Config.Default.CertificateFilename != "") && File.Exists(Config.Default.CertificateFilename))
            {
                try {
                    Config.Default.Certificate = new X509Certificate2(Config.Default.CertificateFilename, Config.Default.CertificatePassword);
                } catch (Exception ex) {
                    RMLog.Exception(ex, "--Error loading cert file");
                }
            }

            try {
                RMLog.Info("Starting WebSocket proxy thread");
                _WebSocketServer = new WebSocketServerThread("0.0.0.0", Config.Default.ListenPort);
                _WebSocketServer.Start();
            } catch (Exception ex) {
                RMLog.Exception(ex, "Failed to start WebSocket proxy thread");
                Environment.Exit(1);
            }
        }
        public void Start()
        {
            RMLog.Handler += RMLog_Handler;

            RMLog.Info("fTelnetProxy Starting Up");

            Config.Default.Load();
            ParseEnvironmentVariables();
            ParseCommandLineArgs();

            if (!string.IsNullOrWhiteSpace(Config.Default.CertificateFilename) && File.Exists(Config.Default.CertificateFilename))
            {
                try {
                    if (OSUtils.IsUnix)
                    {
                        Environment.SetEnvironmentVariable("MONO_TLS_PROVIDER", "btls");
                    }

                    // Try loading the certificate to ensure there are no problems
                    var testCert = Config.Default.Certificate;
                } catch (Exception ex) {
                    // Loading cert failed, so wipe the filename to ensure we don't try loading it again later
                    RMLog.Exception(ex, "--Error loading cert file");
                    Config.Default.CertificateFilename = null;
                }
            }

            try {
                RMLog.Info("Starting WebSocket proxy thread");
                _WebSocketServer = new WebSocketServerThread("0.0.0.0", Config.Default.ListenPort);
                _WebSocketServer.ListeningEvent += WebSocketServer_ListeningEvent;
                _WebSocketServer.Start();
            } catch (Exception ex) {
                RMLog.Exception(ex, "Failed to start WebSocket proxy thread");
                Environment.Exit(1);
            }
        }