diff --git a/README.md b/README.md index df2c22c..b18ee72 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,25 @@ +

+ SSRSpeedN +

+

+Batch speed measuring tool based on Shadowsocks(R) and V2Ray +

+

+ + + +

+ +## 赞赏码 +

+ SSRSpeedN +

+

+要饭人士跪求各位大佬雪中送炭 +

+ +## 注意事项 -## - 测速及解锁测试仅供参考,不代表实际使用情况,由于网络情况变化、Netflix封锁及ip更换,测速具有时效性 - 本项目使用 [Python](https://www.python.org/) 编写,使用前请完成环境安装 diff --git a/ssrspeed/result/export_result.py b/ssrspeed/result/export_result.py index 0bb116a..ca60921 100644 --- a/ssrspeed/result/export_result.py +++ b/ssrspeed/result/export_result.py @@ -94,10 +94,10 @@ def __getMaxWidth(self,result): remark = item["remarks"] inres = item["InRes"] outres = item["OutRes"] - maxGroupWidth = max(maxGroupWidth, draw.textbbox((0, 0), group, font=font)[2]) - maxRemarkWidth = max(maxRemarkWidth, draw.textbbox((0, 0), remark, font=font)[2]) - lenIn = max(lenIn, draw.textbbox((0, 0), inres, font=font)[2]) - lenOut = max(lenOut, draw.textbbox((0, 0), outres, font=font)[2]) + maxGroupWidth = max(maxGroupWidth,draw.textsize(group,font=font)[0]) + maxRemarkWidth = max(maxRemarkWidth,draw.textsize(remark,font=font)[0]) + lenIn = max(lenIn, draw.textsize(inres, font=font)[0]) + lenOut = max(lenOut, draw.textsize(outres, font=font)[0]) return (maxGroupWidth + 10,maxRemarkWidth + 10,lenIn + 20,lenOut + 20) def __getMaxWidthStream(self,result): @@ -149,8 +149,8 @@ def __deweighting(self,result): def __getBasePos(self, width, text): font = self.__font - draw = ImageDraw.Draw(Image.new("RGB", (1, 1), (255, 255, 255))) - textSize = draw.textbbox((0, 0), text, font=font)[2] + draw = ImageDraw.Draw(Image.new("RGB",(1,1),(255,255,255))) + textSize = draw.textsize(text, font=font)[0] basePos = (width - textSize) / 2 logger.debug("Base Position {}".format(basePos)) return basePos diff --git a/start.bat "b/\345\274\200\345\247\213\346\265\213\351\200\237.bat" similarity index 97% rename from start.bat rename to "\345\274\200\345\247\213\346\265\213\351\200\237.bat" index 23ab08c..d807972 100644 --- a/start.bat +++ "b/\345\274\200\345\247\213\346\265\213\351\200\237.bat" @@ -1,234 +1,234 @@ -@echo off& -echo. -echo ##### SSRSpeedĿ¼ ##### -echo. -if exist "%~dp0\main.py" (python main.py --version>ver.txt && for /f "delims=" %%i in (ver.txt) do ( set ver=%%i ) && echo SSRSpeedĿ¼£ӭʹ && echo ǰ汾%%i && del ver.txt) else (echo SSRSpeedĿ¼У ) -if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 -bcdedit >nul -if '%errorlevel%' NEQ '0' (echo ǰ޹ԱȨ) else (echo ǰѻȡԱȨ) -if exist "%~dp0\clients\v2ray-core\v2ray.exe" ( set v1=1 ) else ( set v1=0 ) -if exist "%~dp0\clients\v2ray-core\v2ctl.exe" ( set v2=1 ) else ( set v2=0 ) -set /a v3=v1+v2 -if %v3%==2 (echo ѰװV2ray-core ) else (echo δװV2ray-core ) -:start -echo ==================================== -echo 1ʼ٣Զã -echo 2״ǰװpip֧֣ҪԱȨޣ -echo 3 -echo 4ǰSSRSpeed汾 -echo 5ΪлȡԱȨ -echo ==================================== -echo ѡ1~5 -choice /c 12345 -if %errorlevel%==5 (goto :uac) -if %errorlevel%==4 (goto :ver) -if %errorlevel%==3 (goto :help) -if %errorlevel%==2 (goto :pip) -if %errorlevel%==1 (goto :test2) - - -:pip -if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 -bcdedit >nul -if '%errorlevel%' NEQ '0' (echo #ǰ޹ԱȨޣ޷װ && echo. && echo #ͨ5ȡȨޣҼԹԱȨ && pause && goto :start) else (goto :pip2) -:pip2 -python -m pip install --upgrade pip -pip3 install -r %~dp0%\requirements.txt -::pip3 install requests -::pip3 install pyyaml -::pip3 install Pillow -::pip3 install pysocks -::pip3 install aiohttp -::pip3 install aiohttp_socks -::pip3 install requests[socks] -::pip3 install flask -::pip3 install flask-cors -pause -goto :start - -:ver -python main.py --version -pause -goto :start - -:help -echo. -echo 1ԭģen -echo 2루zh -choice /c 12 -if %errorlevel%==2 (goto :fy) -if %errorlevel%==1 (goto :yw) - -:yw - -echo. -echo Usage: main.py [options] arg1 arg2... -echo. -echo Options: -echo. -echo --version show program's version number and exit -echo -h, --help show this help message and exit -echo -c GUICONFIG, --config=GUICONFIG Load config generated by shadowsocksr-csharp. -echo -u URL, --url=URL Load ssr config from subscription url. -echo -m TEST_METHOD, --method=TEST_METHOD Select test method in Select test method in [speedtestnet, fast, socket, stasync]. -echo -M TEST_MODE, --mode=TEST_MODE Select test mode in [all,pingonly,wps]. -echo --include Filter nodes by group and remarks using keyword. -echo --include-remark Filter nodes by remarks using keyword. -echo --include-group Filter nodes by group name using keyword. -echo --exclude Exclude nodes by group and remarks using keyword. -echo --exclude-group Exclude nodes by group using keyword. -echo --exclude-remark Exclude nodes by remarks using keyword. -echo --use-ssr-cs Replace the ShadowsocksR-libev with the ShadowsocksR-C# (Only Windows) -echo -g GROUP Manually set group. -echo -y, --yes Skip node list confirmation before test. -echo -C RESULT_COLOR, --color=RESULT_COLOR Set the colors when exporting images.. -echo -S SORT_METHOD, --sort=SORT_METHOD Select sort method in [speed,rspeed,ping,rping],default not sorted. -echo -i IMPORT_FILE, --import=IMPORT_FILE Import test result from json file and export it. -echo --skip-requirements-check Skip requirements check. -echo --debug Run program in debug mode. -echo. -echo Test Modes -echo Mode Remark -echo TCP_PING Only tcp ping, no speed test -echo WEB_PAGE_SIMULATION Web page simulation test -echo ALL Full speed test (exclude web page simulation) -echo. -echo Test Methods -echo Methods Remark -echo ST_ASYNC Asynchronous download with single thread -echo SOCKET Raw socket with multithreading -echo SPEED_TEST_NET Speed Test Net speed test -echo FAST Fast.com speed test -echo. -pause -goto :start - -:fy - -echo. -echo ÷main.py [options] arg1 arg2... -echo. -echo ѡ -echo. -echo --version ʾİ汾Ų˳ -echo -h--help ʾ˰Ϣ˳ -echo -c GUICONFIG--config = GUICONFIG shadowsocksr-csharpɵá -echo -u URL--url = URL ӶURLssrá -echo -m TEST_METHOD--method = TEST_METHOD [speedtestnet,fast,socket,stasync]ѡԷ -echo -M TEST_MODE--mode = TEST_MODE [all,pingonly,wps]ѡģʽ -echo --include ˽ڵ㣬ʹùؼע͡ -echo --include-remark ʹùؼͨע͹˽ڵ㡣 -echo --include-group ʹùؼְ˽ڵ㡣 -echo --exclude ųڵ㣬ʹùؼֽע͡ -echo --exclude-group ʹùؼְųڵ㡣 -echo --exclude-remark ͨʹùؼֵעųڵ㡣 -echo --use-ssr-cs ShadowsocksR-C滻ShadowsocksR-libevWindows -echo -g GROUP ֶ顣 -echo -y--yes ǰڵбȷϡ -echo -C RESULT_COLOR--color = RESULT_COLOR ͼʱɫ -echo -S SORT_METHOD--sort = SORT_METHOD [speed,rspeed,ping,rping]ѡ򷽷Ĭϲ -echo -i IMPORT_FILE--import = IMPORT_FILE jsonļԽ -echo -skip-requirements-check Ҫ顣 -echo --debug ڵģʽг -echo. -echo ģʽ -echo ģʽ ע -echo TCP_PING tcp pingٶȲ -echo WEB_PAGE_SIMULATION ҳģ -echo ALL ȫٲԣҳģ⣩ -echo. -echo Է -echo ע -echo ST_ASYNC ߳첽 -echo SOCKET ж̵߳ԭʼ׽ -echo SPEED_TEST_NET SpeedTest.NetٶȲ -echo FAST Fast.comٶȲ -echo. -pause -goto :start - -:test2 -echo. -echo Զѡջس -echo. -:test3 -set /p a=Ķ(): -if "%a%"=="" ( -goto :test3 -) else ( -goto :jx1 -) -:jx1 -echo 2ͨոָؼ -set /p e=1.ʹùؼͨעɸѡڵ: -set /p i=2.ͨʹùؼֵעųڵ: -set /p k=3.: -set /p m=4.ͼʱɫ[origin,poor],Ĭorigin: -set /p n=5.[speed,rspeed,ping,rping]ѡ򷽷ĬϲĬ: -echo. -if "%e%"=="" ( -set e= && goto :jx1 -) else ( -set e=--include-remark %e% && goto :jx1 -) -:jx1 -if "%i%"=="" ( -set i= && goto :jx2 -) else ( -set i=--exclude-remark %i% && goto :jx2 -) -:jx2 -if "%k%"=="" ( -set k= && goto :jx3 -) else ( -set k=-g %k% && goto :jx3 -) -:jx3 -set l=-y && goto :jx4 -:jx4 -if "%m%"=="" ( -set m= && goto :jx5 -) else ( -set m=-C %m% && goto :jx5 -) -:jx5 -if "%n%"=="" ( -set n= && goto :jx6 -) else ( -set n=-s %n% && goto :jx6 -) -:jx6 -set o=--skip-requirements-check && goto :jx7 -:jx7 -echo python main.py -u "%a%" %e% %i% %k% %y% %m% %n% %o% -echo. -python main.py -u "%a%" %e% %i% %k% %y% %m% %n% %o% -pause -set a= -set e= -set i= -set k= -set y= -set m= -set n= -set o= -goto :start - -:uac -echo. -if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 -bcdedit >nul -if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin) -:UACPrompt -echo ʾͨװҪԱȨޣ4 -echo. -echo ԻȡԱȨޣ -ping -n 3 127.0.0.1>nul && %1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit -exit /B -:UACAdmin -cd /d "%~dp0" -echo. -echo ѻȡԱȨ -echo. -pause +@echo off& +echo. +echo ##### SSRSpeedĿ¼ ##### +echo. +if exist "%~dp0\main.py" (python main.py --version>ver.txt && for /f "delims=" %%i in (ver.txt) do ( set ver=%%i ) && echo SSRSpeedĿ¼£ӭʹ && echo ǰ汾%%i && del ver.txt) else (echo SSRSpeedĿ¼У ) +if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 +bcdedit >nul +if '%errorlevel%' NEQ '0' (echo ǰ޹ԱȨ) else (echo ǰѻȡԱȨ) +if exist "%~dp0\clients\v2ray-core\v2ray.exe" ( set v1=1 ) else ( set v1=0 ) +if exist "%~dp0\clients\v2ray-core\v2ctl.exe" ( set v2=1 ) else ( set v2=0 ) +set /a v3=v1+v2 +if %v3%==2 (echo ѰװV2ray-core ) else (echo δװV2ray-core ) +:start +echo ==================================== +echo 1ʼ٣Զã +echo 2״ǰװpip֧֣ҪԱȨޣ +echo 3 +echo 4ǰSSRSpeed汾 +echo 5ΪлȡԱȨ +echo ==================================== +echo ѡ1~5 +choice /c 12345 +if %errorlevel%==5 (goto :uac) +if %errorlevel%==4 (goto :ver) +if %errorlevel%==3 (goto :help) +if %errorlevel%==2 (goto :pip) +if %errorlevel%==1 (goto :test2) + + +:pip +if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 +bcdedit >nul +if '%errorlevel%' NEQ '0' (echo #ǰ޹ԱȨޣ޷װ && echo. && echo #ͨ5ȡȨޣҼԹԱȨ && pause && goto :start) else (goto :pip2) +:pip2 +python -m pip install --upgrade pip +pip3 install -r %~dp0%\requirements.txt +::pip3 install requests +::pip3 install pyyaml +::pip3 install Pillow +::pip3 install pysocks +::pip3 install aiohttp +::pip3 install aiohttp_socks +::pip3 install requests[socks] +::pip3 install flask +::pip3 install flask-cors +pause +goto :start + +:ver +python main.py --version +pause +goto :start + +:help +echo. +echo 1ԭģen +echo 2루zh +choice /c 12 +if %errorlevel%==2 (goto :fy) +if %errorlevel%==1 (goto :yw) + +:yw + +echo. +echo Usage: main.py [options] arg1 arg2... +echo. +echo Options: +echo. +echo --version show program's version number and exit +echo -h, --help show this help message and exit +echo -c GUICONFIG, --config=GUICONFIG Load config generated by shadowsocksr-csharp. +echo -u URL, --url=URL Load ssr config from subscription url. +echo -m TEST_METHOD, --method=TEST_METHOD Select test method in Select test method in [speedtestnet, fast, socket, stasync]. +echo -M TEST_MODE, --mode=TEST_MODE Select test mode in [all,pingonly,wps]. +echo --include Filter nodes by group and remarks using keyword. +echo --include-remark Filter nodes by remarks using keyword. +echo --include-group Filter nodes by group name using keyword. +echo --exclude Exclude nodes by group and remarks using keyword. +echo --exclude-group Exclude nodes by group using keyword. +echo --exclude-remark Exclude nodes by remarks using keyword. +echo --use-ssr-cs Replace the ShadowsocksR-libev with the ShadowsocksR-C# (Only Windows) +echo -g GROUP Manually set group. +echo -y, --yes Skip node list confirmation before test. +echo -C RESULT_COLOR, --color=RESULT_COLOR Set the colors when exporting images.. +echo -S SORT_METHOD, --sort=SORT_METHOD Select sort method in [speed,rspeed,ping,rping],default not sorted. +echo -i IMPORT_FILE, --import=IMPORT_FILE Import test result from json file and export it. +echo --skip-requirements-check Skip requirements check. +echo --debug Run program in debug mode. +echo. +echo Test Modes +echo Mode Remark +echo TCP_PING Only tcp ping, no speed test +echo WEB_PAGE_SIMULATION Web page simulation test +echo ALL Full speed test (exclude web page simulation) +echo. +echo Test Methods +echo Methods Remark +echo ST_ASYNC Asynchronous download with single thread +echo SOCKET Raw socket with multithreading +echo SPEED_TEST_NET Speed Test Net speed test +echo FAST Fast.com speed test +echo. +pause +goto :start + +:fy + +echo. +echo ÷main.py [options] arg1 arg2... +echo. +echo ѡ +echo. +echo --version ʾİ汾Ų˳ +echo -h--help ʾ˰Ϣ˳ +echo -c GUICONFIG--config = GUICONFIG shadowsocksr-csharpɵá +echo -u URL--url = URL ӶURLssrá +echo -m TEST_METHOD--method = TEST_METHOD [speedtestnet,fast,socket,stasync]ѡԷ +echo -M TEST_MODE--mode = TEST_MODE [all,pingonly,wps]ѡģʽ +echo --include ˽ڵ㣬ʹùؼע͡ +echo --include-remark ʹùؼͨע͹˽ڵ㡣 +echo --include-group ʹùؼְ˽ڵ㡣 +echo --exclude ųڵ㣬ʹùؼֽע͡ +echo --exclude-group ʹùؼְųڵ㡣 +echo --exclude-remark ͨʹùؼֵעųڵ㡣 +echo --use-ssr-cs ShadowsocksR-C滻ShadowsocksR-libevWindows +echo -g GROUP ֶ顣 +echo -y--yes ǰڵбȷϡ +echo -C RESULT_COLOR--color = RESULT_COLOR ͼʱɫ +echo -S SORT_METHOD--sort = SORT_METHOD [speed,rspeed,ping,rping]ѡ򷽷Ĭϲ +echo -i IMPORT_FILE--import = IMPORT_FILE jsonļԽ +echo -skip-requirements-check Ҫ顣 +echo --debug ڵģʽг +echo. +echo ģʽ +echo ģʽ ע +echo TCP_PING tcp pingٶȲ +echo WEB_PAGE_SIMULATION ҳģ +echo ALL ȫٲԣҳģ⣩ +echo. +echo Է +echo ע +echo ST_ASYNC ߳첽 +echo SOCKET ж̵߳ԭʼ׽ +echo SPEED_TEST_NET SpeedTest.NetٶȲ +echo FAST Fast.comٶȲ +echo. +pause +goto :start + +:test2 +echo. +echo Զѡջس +echo. +:test3 +set /p a=Ķ(): +if "%a%"=="" ( +goto :test3 +) else ( +goto :jx1 +) +:jx1 +echo 2ͨոָؼ +set /p e=1.ʹùؼͨעɸѡڵ: +set /p i=2.ͨʹùؼֵעųڵ: +set /p k=3.: +set /p m=4.ͼʱɫ[origin,poor],Ĭorigin: +set /p n=5.[speed,rspeed,ping,rping]ѡ򷽷ĬϲĬ: +echo. +if "%e%"=="" ( +set e= && goto :jx1 +) else ( +set e=--include-remark %e% && goto :jx1 +) +:jx1 +if "%i%"=="" ( +set i= && goto :jx2 +) else ( +set i=--exclude-remark %i% && goto :jx2 +) +:jx2 +if "%k%"=="" ( +set k= && goto :jx3 +) else ( +set k=-g %k% && goto :jx3 +) +:jx3 +set l=-y && goto :jx4 +:jx4 +if "%m%"=="" ( +set m= && goto :jx5 +) else ( +set m=-C %m% && goto :jx5 +) +:jx5 +if "%n%"=="" ( +set n= && goto :jx6 +) else ( +set n=-s %n% && goto :jx6 +) +:jx6 +set o=--skip-requirements-check && goto :jx7 +:jx7 +echo python main.py -u "%a%" %e% %i% %k% %y% %m% %n% %o% +echo. +python main.py -u "%a%" %e% %i% %k% %y% %m% %n% %o% +pause +set a= +set e= +set i= +set k= +set y= +set m= +set n= +set o= +goto :start + +:uac +echo. +if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0 +bcdedit >nul +if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin) +:UACPrompt +echo ʾͨװҪԱȨޣ4 +echo. +echo ԻȡԱȨޣ +ping -n 3 127.0.0.1>nul && %1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit +exit /B +:UACAdmin +cd /d "%~dp0" +echo. +echo ѻȡԱȨ +echo. +pause goto :start \ No newline at end of file