示例#1
0
文件: Pinger.cs 项目: jroeber/checker
        public static IObservable <Report> Create(PingConfig config)
        {
            string host    = config.Host;
            int    rate    = config.Rate * 1000;
            int    timeout = config.Timeout * 1000;

            return(Pinger.Create(host, rate, timeout));
        }
示例#2
0
        public static IObservable <Report> Build(HostConfig conf)
        {
            switch (conf)
            {
            case PingConfig p: return(Pinger.Create(p));

            case TcpConfig t:
                switch (t)
                {
                case HttpConfig h: return(HttpConnector.Create(h));

                default: return(TcpConnector.Create(t));
                }

            default:
                throw new ArgumentException($"Unsupported HostConfig type: {conf.GetType()}");
            }
        }