Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            try
            {
                var _server = new RadiusServer
                              {
                                  //10.249.195.123
                                  AcctPort = 1813,
                                  AuthPort = 1812,
                                  ListenAccountIp = IPAddress.Parse("10.249.195.123"),
                                  ListenAuthIp = IPAddress.Parse("10.249.195.123")
                              };


                _server.Start(true, false);
                while (true)
                {
                    Console.WriteLine("press exit for exit");
                    string s = Console.ReadLine();
                    if (s.ToLower() == "exit")
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ILog log = LogManager.GetLogger(typeof(Program));
                log.Debug("Failed in running.", ex);
            }
        }
Ejemplo n.º 2
0
        protected override void OnStart(string[] args)
        {
            Config    config;
            IPAddress accountListentIp = IPAddress.Parse("127.0.0.1");
            IPAddress authIp           = IPAddress.Parse("127.0.0.1");

            try
            {
                config = ServiceCfg.Instance.TinyConfig;
                if (!String.IsNullOrEmpty(config.AccountListentIp))
                {
                    if (!IPAddress.TryParse(config.AccountListentIp, out accountListentIp))
                    {
                        Log.Error("accountList IP isn't validate, so auto set to 127.0.0.1");
                    }
                }

                if (!String.IsNullOrEmpty(config.AuthListentIp))
                {
                    if (!IPAddress.TryParse(config.AuthListentIp, out authIp))
                    {
                        Log.Error(("Auth Ip isn't validate, so auto set to 127.0.0.1"));
                    }
                }
                _server = new RadiusServer
                {
                    AcctPort        = config.AcctPort,
                    AuthPort        = config.AuthPort,
                    ListenAccountIp = accountListentIp,
                    ListenAuthIp    = authIp
                };
                _server.Start(config.EnableAuthentication, config.EnableAccount);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
Ejemplo n.º 3
0
        protected override void OnStart(string[] args)
        {
            Config config;
            IPAddress accountListentIp = IPAddress.Parse("127.0.0.1");
            IPAddress authIp = IPAddress.Parse("127.0.0.1");
            try
            {
                config = ServiceCfg.Instance.TinyConfig;
                if (!String.IsNullOrEmpty(config.AccountListentIp))
                {
                    if (!IPAddress.TryParse(config.AccountListentIp, out accountListentIp))
                    {
                        Log.Error("accountList IP isn't validate, so auto set to 127.0.0.1");
                    }
                }

                if (!String.IsNullOrEmpty(config.AuthListentIp))
                {
                    if (!IPAddress.TryParse(config.AuthListentIp, out authIp))
                    {
                        Log.Error(("Auth Ip isn't validate, so auto set to 127.0.0.1"));
                    }
                }
                _server = new RadiusServer
                              {
                                  AcctPort = config.AcctPort,
                                  AuthPort = config.AuthPort,
                                  ListenAccountIp = accountListentIp,
                                  ListenAuthIp = authIp
                              };
                _server.Start(config.EnableAuthentication, config.EnableAccount);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }