Exemplo n.º 1
0
        public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List <int> selecteds, string actionType, Action <int, string> update)
        {
            _config       = config;
            _v2rayHandler = v2rayHandler;
            _selecteds    = selecteds;
            _updateFunc   = update;

            if (actionType == "ping")
            {
                _workThread = new Thread(new ThreadStart(RunPing));
                _workThread.Start();
            }
            if (actionType == "tcping")
            {
                _workThread = new Thread(new ThreadStart(RunTcping));
                _workThread.Start();
            }
            else if (actionType == "realping")
            {
                _workThread = new Thread(new ThreadStart(RunRealPing));
                _workThread.Start();
            }
            else if (actionType == "speedtest")
            {
                RunSpeedTest();
            }
        }
Exemplo n.º 2
0
        public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List <int> selecteds, string actionType, Action <int, string> update)
        {
            _config       = config;
            _v2rayHandler = v2rayHandler;
            //_selecteds = Utils.DeepCopy(selecteds);
            _updateFunc = update;

            _selecteds = new List <ServerTestItem>();
            foreach (var it in selecteds)
            {
                _selecteds.Add(new ServerTestItem()
                {
                    selected   = it,
                    indexId    = config.vmess[it].indexId,
                    address    = config.vmess[it].address,
                    port       = config.vmess[it].port,
                    configType = config.vmess[it].configType
                });
            }

            if (actionType == "ping")
            {
                Task.Run(() => RunPing());
            }
            if (actionType == "tcping")
            {
                Task.Run(() => RunTcping());
            }
            else if (actionType == "realping")
            {
                Task.Run(() => RunRealPing());
            }
            else if (actionType == "speedtest")
            {
                Task.Run(() => RunSpeedTest());
            }
        }
Exemplo n.º 3
0
        public SpeedtestHandler(Config config, V2rayHandler v2rayHandler, List <VmessItem> selecteds, ESpeedActionType actionType, Action <string, string> update)
        {
            _config       = config;
            _v2rayHandler = v2rayHandler;
            //_selecteds = Utils.DeepCopy(selecteds);
            _updateFunc = update;

            _selecteds = new List <ServerTestItem>();
            foreach (var it in selecteds)
            {
                _selecteds.Add(new ServerTestItem()
                {
                    indexId    = it.indexId,
                    address    = it.address,
                    port       = it.port,
                    configType = it.configType
                });
            }

            if (actionType == ESpeedActionType.Ping)
            {
                Task.Run(() => RunPing());
            }
            else if (actionType == ESpeedActionType.Tcping)
            {
                Task.Run(() => RunTcping());
            }
            else if (actionType == ESpeedActionType.Realping)
            {
                Task.Run(() => RunRealPing());
            }
            else if (actionType == ESpeedActionType.Speedtest)
            {
                Task.Run(() => RunSpeedTestAsync());
            }
        }
        public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List <int> selecteds, string actionType, Action <int, string> update)
        {
            _config       = config;
            _v2rayHandler = v2rayHandler;
            _selecteds    = Utils.DeepCopy(selecteds);
            _updateFunc   = update;

            if (actionType == "ping")
            {
                Task.Run(() => RunPing());
            }
            if (actionType == "tcping")
            {
                Task.Run(() => RunTcping());
            }
            else if (actionType == "realping")
            {
                Task.Run(() => RunRealPing());
            }
            else if (actionType == "speedtest")
            {
                Task.Run(() => RunSpeedTest());
            }
        }